All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Nginx Config Yii2 in root and Wordpress in subdirectory
Hey,
I have a website using Yii2 framework, and in a subdirectory called "b" I have a wordpress installation, Yii2 is working fine, but the wordpress installation is not
I'm also using cloudflare's SSL (Full SSL)
This is my configuration file:
server {
listen 443 ssl http2;
server_name www.mydomain.com;
ssl_dhparam /usr/local/nginx/conf/ssl/mydomain.com/dhparam.pem;
ssl_certificate /usr/local/nginx/conf/ssl/mydomain.com/mydomain.com.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/mydomain.com/mydomain.com.key;
include /usr/local/nginx/conf/ssl_include.conf;
# mozilla recommended
ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA:!DES-CBC3-SHA;
ssl_prefer_server_ciphers on;
ssl_buffer_size 1400;
ssl_session_tickets on;
access_log /home/nginx/domains/mydomain.com/log/access.log combined buffer=256k flush=60m;
error_log /home/nginx/domains/mydomain.com/log/error.log;
root /home/nginx/domains/mydomain.com/public;
# prevent access to ./directories and files
location ~ (?:^|/). {
deny all;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location /b {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
include /usr/local/nginx/conf/staticfiles.conf;
include /usr/local/nginx/conf/php.conf;
include /usr/local/nginx/conf/drop.conf;
#include /usr/local/nginx/conf/errorpage.conf;
include /usr/local/nginx/conf/vts_server.conf;
}
Any idea?
Comments
Define
wordpress installation is not
.Not much details were given.
www.mydomain.com has a Yii2 website
www.mydomain.com/b has a wordpress website
Yii2 is working
Wordpress is not working
How exactly its not working ....error or blank page... Tell us about the http error code...
error 500,
I also tried to put a php file in the wordpress installation, https://www.mydomain.com/b/test.php, it's not working either, error 500
check the nginx error log!
"location /b" block
1) no point in having index directive there
2) your try_files directive (might) yield an internal redirect to your "location /" block
For help/advice, more details are necessary, i.e. nginx/conf/php.conf and location of Wordpress installation. Maybe even FPM's conf. For debugging you might want to temporary replace Wordpress' index.php with sth. just responding with path and request parameters (environment).
Fix this part:
Next run
chown -R nginx-user:nginx-group /path/to/your/web/
substitue nginx-user and nginx-group with your own, for Debian it's www-data.
post the logs on pastebin....
and also try commenting out the location /b rule....
and see if it works temporarily for .html file ....
Then debug from there :-)
Nothing in the logs...
Removing the /b doesn't help..
All Permissions are correct
.html & .txt are working fine, it seems php is getting blocked or messed up somewhere.
It's a centminmod installation, I think it has to do with the php.conf
Original configuration file (in the main post)
https://pastebin.com/aiS7ZKiA
staticfiles.conf
https://pastebin.com/XaTfjbyu
php.conf
https://pastebin.com/tbGwyLq0
drop.conf
https://pastebin.com/rKvKpKXj
vts_server.conf
https://pastebin.com/NTshE0aU
Walk of shame
Turned out the configurations are ok, only problem was, somehow wordfence created a .user.ini in wordpress directory and was auto loading a non existing path/file which was crasing the entire subdirectory.
You saidsaid
html & .txt are working fine, it seems php is getting blocked or messed up somewhere.
I thought you tested simple php file
Next time it happens create a file with phpinfo function and then debug it...