Nginx反向代理上的无限重定向循环

问题描述 投票:0回答:1

我有一台运行nginx和闪亮服务器的服务器。 Shiny运行于:3838。从端口8443加载https版本的Shiny时,没有任何问题,但:80上的站点陷入无限重定向循环。

这是配置。

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;
   }
}

我不知道是什么原因造成的。

ssl nginx redirect infinite-loop nginx-reverse-proxy
1个回答
0
投票

根据Richard Smith的评论,我删除了侦听443的服务器部分,此问题已解决。

© www.soinside.com 2019 - 2024. All rights reserved.