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

问题描述

我的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

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...