1

I am using this setting for nginx (default file):

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;

        }
}

When I try to access 30425, I am getting 502 Bad Gateway. All other setting are default one (PHP 7).

Sasha
  • 8,521
  • 23
  • 91
  • 174

1 Answers1

4

I had to replace this fastcgi_pass 127.0.0.1:9000;
to fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; and then it worked perfectly.

Full code.

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

}