Report this

What is the reason for this report?

502 Nginx Issue - Website not showing unless logged in to WordPress

Posted on June 25, 2017

I have recently added a 2nd domain to a single Ubuntu 16.04 server and created the necessary files for use with Nginx. This allows Nginx to point to both directory paths for the corresponding domains.

I currently have http://whatjackhasmade.co.uk and https://noface.co.uk.

https://noface.co.uk is unaccessible until I go to https://noface.co.uk/wp-admin and login to my account.

Here is the following sites-available file for noface.co.uk, the sites-enabled is a symlink to this file.

# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name noface.co.uk www.noface.co.uk;
        return 301 https://$server_name$request_uri;
}

server {

        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        include snippets/ssl-noface.co.uk.conf;
        include snippets/ssl-params.conf;

        root /var/www/noface.co.uk/html/wordpress;

        index index.php index.html index.htm index.nginx-debian.html;

        server_name noface.co.uk www.noface.co.uk;

        location / {
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }

        location ~ /.well-known {
                allow all;
        }
}

The issue has only recently occured since I have enabled https:// with an SSL certificate. The https:// works but only when accessing wp/admin. Any help would be greatly appreciated.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @jacknoface

I don’t see any error, when going to the site - only a blank page. So you need to check the error log for further details. Try running this command to get the last 30 lines:

tail -30 /var/log/nginx/error.log

And like @CrypticDesigns says, the try_files isn’t correct for WordPress. Should be:

try_files $uri $uri/ /index.php?$args;

Thanks, @hansen turns out WP Total Cache plugin was the issue, I’ll do some research into using an alternative plugin.

Thank you for the compliment on the logo, speed is one of my main focuses with websites, I aim for a 1 second load speed or as close as I can get :)

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.