目前,如果我在https://
域前没有www.mysite.com.au
,我的网站就无效。
如何让我的nginx配置将所有http://,mysite.com.au,www.mysite.com.au重定向到https://mysite.com.au。我从教程中得到了以下配置:
server {
# Enable HTTP/2
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name mysite.com.au;
root /www/mysite.com.au;
# Use the Let’s Encrypt certificates
ssl_certificate /etc/letsencrypt/live/mysite.com.au/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mysite.com.au/privkey.pem;
# Include the SSL configuration from cipherli.st
include snippets/ssl-params.conf;
location / {
root /home/farah/;
index index.html;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}