#80端口转到443端口
server{
listen 80;
server_name www.域名.com;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443;
server_name www.域名.com;
ssl on;
ssl_certificate key/server.crt;
ssl_certificate_key key/server.key;
ssl_session_timeout 5m;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
}
http https 同时支持
server {
listen 8080 default backlog=2048;
listen 443 ssl;
server_name www.域名.com;
rewrite ^(.*)https://$server_name$1 permanent;
#ssl on;
ssl_certificate key/server.crt;
ssl_certificate_key key/server.key;
ssl_session_timeout 5m;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
}
网友评论