我的 nginx 文件没有文件失败,我不确定如何。我已经成功地从 http 重定向到 https 很好。但我无法让 www 重定向到非 www 版本。我究竟做错了什么?
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/sammy/myproject;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/sammy/myproject/myproject.sock;
}
# added for let's encrypt
location /.well-known/ {
root /home/sammy/myproject;
allow all;
}
}
server {
# SSL configuration
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
location = /favicon.ico { …Run Code Online (Sandbox Code Playgroud)