• Wordpress Version: Latest
    OS: Debian 10
    PHP: 7.4
    NGINX: 1.14.2

    WordPress files are at /var/www/wordpress, level 775 permissions owned by www-data:www-data recursively on the directory and its sub-directories, NGINX has been configured as follows:

    sudo unlink /etc/nginx/sites-enabled/default

    sudo ls -s /etc/nginx/sites-available/t20.digital /etc/nginx/sites-enabled/t20.digital

    virtual host file at /etc/nginx/sites-available/t20.digital reads as follows:

    
    upstream php {
        server unix:/tmp/php-cgi.socket;
        server 127.0.0.1:9000;
    }
    
    server {
        server_name t20.digital;
        root /var/www/wordpress;
        index index.php;
        
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
        
        location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
        }
        
        location / {
            try_files $uri $uri/ /index.php?$args;
        }
        
        location ~ \.php$ {
            include fastcgi_params;
            fastcgi_intercept_errors on;
            fastcgi_pass php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
        
        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
        }
    }
    

    NGINX config is setup exactly as per NGINX Documentation reccomends, NGINX returns 502 bad gateway when accessing the server via https://ip

    Support hugely appreciated!

Viewing 1 replies (of 1 total)
  • Moderator Yui

    (@fierevere)

    永子

    upstream php {
        server unix:/tmp/php-cgi.socket;
        server 127.0.0.1:9000;
    }

    You shall have PHP CGI running here, on this socket.
    Try installing and setting up php-fpm

    If Nginx will be unable to connect to upstream PHP – it will throw 502

    PS: nginx does NOT care about file permissions and ownership, they should be only READABLE, nginx will never attempt to WRITE them

    • This reply was modified 4 years, 4 months ago by Yui.
Viewing 1 replies (of 1 total)
  • The topic ‘502 Error Fresh NGINX Installation’ is closed to new replies.