beginner here ;)
I moved a page from one VPS to another and after installing nginx,php7 etc (using this tutorial) everything is working great. Added SSL no problem at all.
However if I execute any php files (f.e hello world) in any newly created subfolder f.e mydomain.pw/newfolder/index.php I get a blank result. If I execute the same file in the page root folder (WP), it works fine.
I have added my user to the www-data group and gave the same permission as I did on the former VPS. If I check the nginx error log or php7.0-fpm.log I get no error at all.
If anyone has any hint or idea what the problem is, I'd really appreciate it. I suspect a permission error but searched on SO and Google without success.
Here is my nginx conf :
server {
listen [::]:80 default_server ipv6only=on;
listen 80 default_server;
# listen on the www and non-www host
server_name www.mydomain.pw mydomain.pw;
root /var/www/mydomain;
index index.html index.htm index.php ;
# and redirect to the https host (declared below)
return 301 https://mydomain.pw$request_uri;
location ~ \.php$ {
try_files $uri $uri/ /index.php?$args;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen [::]:443 ssl;
listen 443 ssl;
server_name www.mydomain.pw mydomain.pw;
root /var/www/mydomain;
index index.html index.htm index.php;
ssl_certificate /etc/letsencrypt/live/mydomain.pw/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mydomain.pw/privkey.pem;
location ~ \.php$ {
try_files $uri $uri/ /index.php?$args;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
}
Thanks in advance!