nginx部署ssl
1、让不带ssl的链接强制跳转到ssl链接。
server {
server_name china.wenhq.com;
rewrite ^/(.*)$ https://china.wenhq.com/$1 permanent;
}
2、配置ssl
server
{
listen 443;
server_name china.wenhq.com;
ssl on;
ssl_certificate /usr/local/etc/server.crt;
ssl_certificate_key /usr/local/etc/server.key;
index index.jsp index.htm index.html;
root /data/wenhq/ROOT;
rewrite ^(.*)\;jsessionid=.*$ $1;
error_page 404 403 500 502 503 504 /404.html;
location = /404.html {
root /usr/local/nginx/html;
}
#limit_conn crawler 20;
location ~ .*\.(jsp|action|vm)$
{
index index.jsp;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:8080;
}
}
欢迎转载,请注明出处:亲亲宝宝