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.
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.
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 :)
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;
Something you might have overseen, did you check in the wordpress settings at general? There you can edit the site link (http/https).
@CrypticDesigns I’ve posted the log; I apologise in advance as I am no expert when it comes to debugging the Nginx log.
I’ve also updated the try_files, and the problem still exists. :/
Check the error logs and see what you can find there. If you don’t know what it says, post it here please. Maybe try to use
try_files $uri $uri/ /index.php?$args;
insidelocation /
I had a look at the general settings, and the site link did need updating. However, Nginx still returns a 302 error, or my website returns a 500 HTTP Error.