I've been given an NGNIX server that previously only had Ubuntu 18.04 and NGNIX installed and was used to render a static html site.
I've installed PHP, MySqli ect and configured the sites-available file to get the website up and running. After importing the database from the development site to the live site the website is working perfectly fine as expected apart from one bug.
If I click on a draft page while in 'Split Mode' or 'Preview Mode' I get redirected to the 'Page Not Found' within the admin. If I switch to 'Edit Mode' everything works perfectly fine. Once I publish the draft page I can then view it in 'Split Mode' or 'Preview mode' perfectly fine.
I'm wondering if it's got something to do with my NGNIX config. I configured my sites-available/default file using the link below: https://www.nginx.com/resources/wiki/start/topics/recipes/silverstripe/#recipe
here is my ngnix sites-available config file
server {
include mime.types;
default_type application/octet-stream;
#listen 80 default_server;
#listen [::]:80 default_server;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl on;
ssl_certificate /etc/ssl/certs/certificate.pem;
ssl_certificate_key /etc/ssl/private/key.key;
root ****************
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name ****************;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri /index.php?query_string;
}
error_page 404 /assets/error-404.html;
error_page 500 /assets/error-500.html;
# see caveats
error_page 502 /assets/error-500.html;
error_page 503 /assets/error-500.html;
location ^~ /assets/ {
sendfile on;
try_files $uri =404;
}
location /index.php {
fastcgi_buffer_size 32k;
fastcgi_busy_buffers_size 64k;
fastcgi_buffers 4 32k;
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
When I navigate to /install.php I get no warnings or errors.
Any clues as to what might cause this? Let me know if you need any more information.