I have set up a sub domain in root directory along with our actual domain. In the root directory the two folders are as follows:
domain.com
sub.domain.com
When going to domain.com (which already existed) things work as expected.
When going to sub.domain.com (which is a wordpress installation) the index.php
file just downloads and the page does not load or execute.
In my etc/nginx/sites-available/sub.domain.com.conf
I have:
server {
listen 80;
root /var/www/sub.domain.com;
index index.php index.html index.htm;
server_name sub.domain.com;
location / {
try_files $uri $uri/ =404;
}
}
I have remembered to restart the nginx server, however, we do use php-fpm so I'm not sure if this could be related.
It must be related to PHP, because when replacing the wordpress installation for a basic index.html file, the page loads as expected. Does anyone know what might be causing this behaviour?