zoukankan      html  css  js  c++  java
  • nginx反响代理tomcat配置ssl

    [root@ceshi conf]# cat /application/nginx/conf/vhost/tomcat_jjn.conf

    server {

        listen 80;

        server_name yan.jjn.com;

        rewrite ^(.*) https://$server_name$1 permanent;

    }

    server {

        listen 443;

        server_name localhost;

        ssl on;

        root html;

        index index.html index.htm;

        ssl_certificate   cert/*.pem;

        ssl_certificate_key  cert/*.key;

        ssl_session_timeout 5m;

        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

        ssl_prefer_server_ciphers on;

        location / {

            root html;

            index index.html index.htm;

        }

         location ~ .*$ {

                           proxy_redirect off;

                           proxy_set_header Host $http_$host;

                           proxy_set_header X-Real-IP $remote_addr;

                           proxy_set_header X-Scheme $scheme;

                           proxy_set_header X-SSL-Protocol $ssl_protocol;

                           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

                           proxy_set_header X-HTTPS-Protocol $ssl_protocol;

                           #对应tomcatserver.xml的设置

                           proxy_set_header X-FORWARDED-PROTO $scheme;

                           expires -1;

                           proxy_pass http://127.0.0.1:8891;

       }

          access_log /application/nginx/logs/jjn.log main;

    }

     [root@ceshi conf]# vim   /application/tomcat/conf/server.xml

    注意:需要修改这里,非常重要

    <Valve className="org.apache.catalina.valves.RemoteIpValve"

                   remoteIpHeader="X-Forwarded-For"

                   protocolHeader="X-Forwarded-Proto"

                   remoteIpProxiesHeader="x-forwarded-by" />

  • 相关阅读:
    第一阶段各队建议
    解决死锁四大方式
    进程和线程区别
    windows 地址空间分配
    Linux下用户组、文件权限详解
    2016总结
    class内部处理
    c++ devived object model
    static
    reinterpret
  • 原文地址:https://www.cnblogs.com/yanqr/p/9722386.html
Copyright © 2011-2022 走看看