我在Ubuntu服务器上运行了一个Node.js应用程序,并使用Let加密设置了SSL配置的Nginx。
我的Nginx配置文件如下所示:
server {
server_name www.example.be example.be;
location / {
proxy_pass http://localhost:3485;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.be/fullchain.pem; # managed by C$
ssl_certificate_key /etc/letsencrypt/live/example.be/privkey.pem; # managed by$
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.example.be) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = example.be) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name www.example.be example.be;
return 404; # managed by Certbot
}
没有SSL,Facebook完全能够抓住我的网址,但是当我激活SSL然后在Facebook共享调试器中提交它时,我会收到以下错误:
无法遵循重定向:URL请求了HTTP重定向,但无法遵循。
循环重定向:我们无法解析规范网址,因为重定向路径包含循环。
重定向路径
输入网址 - > https://www.example.be
301 HTTP重定向 - > https://www.example.be
此外,我对Google的PageSpeed见解也有同样的问题。我到达那里的错误是"尝试加载页面达到了10次重定向的限制"
感谢您的任何建议!
答案 0 :(得分:0)
将https强制重定向更改为此
for