配置文件test.test.com.conf具體的站點配置如下:
# HTTPS server
server {
listen 80;
listen 443 ssl;
server_name test.test.com;
ssl on;
ssl_certificate /usr/local/nginx/certs/1_test.test.com_bundle.crt;
ssl_certificate_key /usr/local/nginx/certs/2_test.test.com.key;
ssl_Session_cache shared:SSL:1m;
ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
if ($server_port = 80 ) {
return 301 https://$host$request_uri;
}
location / {
proxy_pass http://www.xiayu04.cn:3000;
}
#讓http請求重定向到https請求
error_page 497 https://$host$request_uri;
}