我正在尝试配置我的子域名www.chat.feromonn.com但在浏览器中它给出消息“重定向过多”
请让我知道我犯了什么错误:
server {
listen 80;
listen [::]:80;
server_name chat.feromonn.com www.chat.feromonn.com;
return 301 https://www.chat.feromonn.com$request_uri;
}
server {
listen 443 ssl http2; # managed by Certbot
listen [::]:443 ssl http2;
server_name www.chat.feromonn.com chat.feromonn.com;
root /home/feromonn/htdocs/www.chat.feromonn.com/public;
# Your configuration for chat.feromonn.com goes here.
ssl_certificate /etc/letsencrypt/live/chat.feromonn.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/chat.feromonn.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
access_log /home/feromonn/logs/nginx/access.log main;
error_log /home/feromonn/logs/nginx/error.log;
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
location ~ /.well-known {
auth_basic off;
allow all;
}
location / {
proxy_pass http://85.31.235.65;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header X-Varnish;
proxy_redirect http://85.31.235.65 http://www.chat.feromonn.com;
proxy_max_temp_file_size 0;
proxy_connect_timeout 720;
proxy_send_timeout 720;
proxy_read_timeout 720;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map)$ {
add_header Access-Control-Allow-Origin "*";
expires max;
access_log off;
}
if (-f $request_filename) {
break;
}
}
server {
if ($host = chat.feromonn.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
}