Nginx WordPress Subdirectory Configuration

Have a Nginx Server and wordpress present at subdirectory like .Usually by using nginx we have problems with Permalink Settings of the wordpress.

i have searched the web to solve the problem and finally i got the solution it was easy though.this is simple configuration which will put index.php in the url to all the links of wordpress

here is the nginx configuration for wordpress in a blog subdirectory.
server {
listen 80;
root /var/www;
index index.php index.html index.htm;

location / {
index index.php index.html index.htm;

location /blog/ {
try_files $uri $uri/ /blog/index.php?$args;

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;

After updating the configuration files You need to reload the nginx configuration.

sudo service nginx reload

then goto Change the Permalink structure to custom

this solved my problem of links ,File not Found in wordpress .

one more thing always WordPress Address (URL) and  Site Address (URL) should be same  in the above context it should be .you can change this in General Settings.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s