[英]Infinite redirect loop on nginx reverse proxy
I have a server which runs nginx and shiny server.我有一台运行 nginx 和 shiny 服务器的服务器。 Shiny runs on:3838.
Shiny 运行于:3838。 While the https version of shiny is loading without any problems from port 8443, the site on:80 gets in an infinite redirect loop.
当 shiny 的 https 版本从端口 8443 加载时没有任何问题,站点 on:80 进入无限重定向循环。
This is the configuration.这是配置。
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name **mydomain**;
root /var/www/html;
index index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name **mydomain**;
ssl_certificate /etc/ssl/certs/**mycertificate**.pem;
ssl_certificate_key /etc/ssl/private/**mykey**.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;
location / {
proxy_pass http://**mydomain**;
proxy_redirect http://**mydomain**/ https://$host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
}
}
server {
listen 8443 ssl;
server_name **mydomain**;
ssl_certificate /etc/ssl/certs/**mycertificate**.pem;
ssl_certificate_key /etc/ssl/private/**mykey**.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;
location / {
proxy_pass http://**mydomain**:3838;
proxy_redirect http://**mydomain**:3838/ https://$host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
}
}
I can't understand what might be the cause of the issue.我不明白问题的原因可能是什么。
According to Richard Smith's comment, I removed the server section that listens to 443 and the issue was fixed.根据 Richard Smith 的评论,我删除了监听 443 的服务器部分,问题得到了修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.