nginx版本
nginx version: nginx/1.10.2
已經實現了http://(www).airknow.com 跳到https://www.airknow.com,但無法實作https://airknow.com 跳到https://www.airknow .com 該怎麼修改配置
以下是我配置
server {
listen 80;
server_name airknow.com;
return 301 http://www.airknow.com$request_uri;
}
server {
listen 80;
server_name www.airknow.com;
return 301 https://www.airknow.com$request_uri;
}
server {
listen 443;
server_name www.airknow.com;
ssl on;
#...
}
高洛峰2017-05-16 17:10:48
我嘗試過在上面第二個server和第三個server之間新加一個server
server {
listen 443;
server_name airknow.com
return 301 https://www.airknow.com$request_uri;
}
重啟後https://airknow.com網站都造訪不了。
ringa_lee2017-05-16 17:10:48
跟你一樣的問題,找到了答案
server {
listen 443;
server_name airknow.com
return 301 https://www.airknow.com$request_uri;
}
server {
listen 443 default_server ssl;
server_name www.airknow.com;
}
像上面這樣,在第三個server的443後面加上default_server ssl,不知道會不會有什麼負面影響