nginx 和 php-fpm 返回 302 而不是 200

时间:2021-01-06 12:20:47

标签: php nginx fpm

我的nginx配置是

server{
    listen 80;
    server_name ~(?<subdomain>[^.]+).mydomain.com
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";
    if ($subdomain != "dev"){
       set $subdomain "main"; 
    }
    root /var/www/html/app_$subdomain/public;
    index index.php index.html;

    underscores_in_headers  on;
    charset utf-8;
    location / {
        proxy_set_header        Upgrade $http_upgrade;
        proxy_pass_header       device_id;
        proxy_set_header        Connection "upgrade";
        proxy_http_version      1.1;
        proxy_set_header        Host $host;
        proxy_read_timeout      120;
        proxy_next_upstream     error timeout invalid_header http_500;
        proxy_connect_timeout   90;
        try_files $uri /index.php?$query_string;
    
    }
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php_fpm:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        include fastcgi_params;
        
    }
}

我使用 aws 应用程序负载平衡器,它一直返回不健康状态,当我跟踪问题时,它在 php-fpm 端返回 302 而不是 200。

注意我在这个过程中使用了docker

谢谢

0 个答案:

没有答案