#配置http请求转发到https
server {
listen 80 ;
server_name http域名;
return 301 $scheme://https域名$request_uri;
}
#https配置ssl
listen 443 ssl;
ssl_certificate /usr/local/nginx/sslkey/xxx.crt;
ssl_certificate_key /usr/local/nginx/sslkey/xxx.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
#nginx 添加ssl后访问页面 https中包含http的情况
需要在配置中 location中添加 proxy_set_header X-Forwarded-Proto $scheme;
tomcat 的server.xml中添加
<Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="X-Forwarded-For" protocolHeader="X-Forwarded-Proto"/>