在最后一行的第4行,应删除ssl
。不知道为什么。如果有人可以解释原因,请添加您的答案。谢谢!
"ERR_EMPTY_RESPONSE"
。Hmmm...can’t reach this page
。WolfPack'08@NV89501:/# curl www.example.com curl: (52) Empty reply from server WolfPack'08@NV89501:/# curl http://example.com curl: (52) Empty reply from server WolfPack'08@NV89501:/# curl http://www.example.com curl: (52) Empty reply from server WolfPack'08@NV89501:/# curl https://www.example.com WolfPack'08@NV89501:/# curl https://example.com <!DOCTYPE html>
server {
set $base /var/www/example.com;
root $base/public;
access_log /var/log/nginx/example.com/access.log;
error_log /var/log/nginx/example.com/error.log;
index index.php;
server_name www.example.com example.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name www.example.com example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
### SECTION INTENDED TO HANDLE WWW-to-NON_WWW REDIRECTS: ###
server {
if ($host = www.example.com) {
return 301 https://$host$request_uri;
}
if ($host = example.com) {
return 301 https://$host$request_uri;
}
listen [::]:80;
listen 80 ssl; ### REMOVE SSL HERE TO FIX. ###
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
listen 80 ssl;
。return 301 https://$host$request_uri;
而不是example.com。>>当然,我每次都重新启动Nginx
更新:罪魁祸首:在第四行至最后一行,应删除ssl。不知道为什么。如果有人可以解释原因,请添加您的答案。谢谢!目标系统信息:我在Debian 10上,...
尝试以下配置