我试图复制我其他网站的配置文件,但它不起作用,也许是因为我有一个代理?我真的不知道有什么问题。 https://mywebsite.lol没问题(由 cloudflare 提供 SSL)
server {
server_name www.irc.mywebsite.lol;
rewrite ^(.*) https://irc.mywebsite.lol$1 permanent;
}
server {
# Port
listen 80;
# Hostname
server_name irc.mywebsite.lol;
# Logs (acces et erreurs)
access_log /var/log/nginx/irc.mywebsite.lol.access.log;
error_log /var/log/nginx/irc.mywebsite.lol.error.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_pass http://localhost:7778/;
proxy_redirect default;
# Websocket support (from version 1.4)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
pagespeed off;
}
}
最佳答案
使用 HTTPS 端口,而不是 HTTP。它应该是
listen 443;
代替
listen 80;
关于redirect - Nginx - 将 www 重定向到 https : ERR_SSL_PROTOCOL_ERROR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32085057/