18
Apr
April 18, 2016, 6:00 pm

nginx设置强制所有连接走https,且带 www的网址自动301到不带www的网址。.

配置如下:

server {
listen 80;
server_name abc.com www.abc.com;
return 301 https://abc.com$request_uri;
}
server {
listen 443 ssl;
server_name www.abc.com;
ssl__certificate ***;
ssl_certificate_key ***;
***;
return 301 https://abc.com$request_uri;
}
server {
listen 443 ssl;
server_name abc.com;
ssl__certificate ***;
ssl_certificate_key ***;
***;
} 
打赏

Next Post Previous Post

Related Posts