For some reason I always have trouble getting WordPress to work on nginx.
I have my WordPress installation in the folder “site” (inside public_html).
This is my nginx configuration:
server {
server_name www.wouterds.be wouterds.be;
access_log /srv/www/www.wouterds.be/logs/access.log;
error_log /srv/www/www.wouterds.be/logs/error.log;
location / {
root /srv/www/www.wouterds.be/public_html;
index index.php index.html index.htm;
try_files $uri $uri/ /site/index.php?$args;
autoindex on;
}
location ~ .php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.wouterds.be/public_html$fastcgi_script_name;
}
}
When I visit my website http://wouterds.be/ I get just the directory index.
When I visit http://wouterds.be/blog/ I get the right page and everything is working.
But I have no idea how to get it work on the base url.
Anyone who can help me out a bit? I’m certainly not an nginx expert and after 4 hours Google-ing I decided to give it a try here.
You can also try (not in a location block):
Exchange
/wp/
for/site/
or whatever your wordpress directory is.Source:
https://wordpress.stackexchange.com/questions/138648/nginx-rules-for-subdomain-multisite-install-bedrock
Just change:
to
assuming wordpress index.php is inside
site
folder.Also move
root
line outside & abovelocation
block.You can try…