【问题标题】:Ubuntu 16.04, nginx, phpmyadmin - 502 Bad GatewayUbuntu 16.04、nginx、phpmyadmin - 502 错误网关
【发布时间】:2017-03-27 10:19:39
【问题描述】:

我正在为 nginx 使用这个设置(默认文件):

server {
        listen 30425;

        # Don't want to log accesses.
        #access_log  /dev/null main;
        access_log  /var/log/nginx/php.acces_log main;
        error_log   /var/log/nginx/php.error_log info;

        root /usr/share/phpmyadmin;
        index  index.php index.html index.htm;
        error_page 401 403 404 /404.php;

        location ~ .*.php$ {
                include fastcgi_params;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param SERVER_NAME $http_host;
                fastcgi_ignore_client_abort on;

        }
}

当我尝试访问 30425 时,我收到 502 Bad Gateway。所有其他设置都是默认设置(PHP 7)。

【问题讨论】:

标签: php nginx phpmyadmin


【解决方案1】:

我不得不替换这个 fastcgi_pass 127.0.0.1:9000;
到 fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; 然后它完美地工作。

完整代码。

server{
    listen 80;
    index index.html index.htm index.php;

    server_name 127.0.0.1;

    root /usr/share/phpmyadmin;
    location / {
            #try_files $uri $uri/ = 404;
            autoindex on;
    }


    location ~\.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+);
            try_files $uri $uri/ =404;
            fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_na$
            fastcgi_param SERVER_NAME $http_host;
            fastcgi_ignore_client_abort on;
    }

}

【讨论】:

  • 从 php 7.3 移动到 7.4 ,但没有更改 fastscgi_pass 版本。谢谢
猜你喜欢
  • 2021-07-24
  • 1970-01-01
  • 2020-04-05
  • 1970-01-01
  • 2011-05-14
  • 2019-06-05
  • 2015-08-10
  • 2021-11-19
  • 2012-09-25
相关资源
最近更新 更多