skip to Main Content

We have wordpress installedin a subdirectory on our NGINX server. We want our blog URL to look something like Individual blog posts urls should be like For this when we go to setting->permalinks menu in wordpress and change it to Post Name from Default, it starts giving error. But it works just fine when we leave it default (
Blog directory is installed under html folder in nginx.
We’ve made following entry in nginx.conf file:

location /blog {

root /usr/share/nginx/html;
index index.html index.php;
try_files $uri $uri/ /index.php?$args;

location ~ .php$ {
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

blog directory is installed at same level as the folder for our main site (
What are we doing wrong?



  1. Try this,

    location /blog/ {
        root /usr/share/nginx/html;
        index index.html index.php;
        try_files $uri $uri/ /blog/index.php?$args;
    Login or Signup to reply.
  2. Had a similar issue and I added this in my nginx conf to make it work for wordpress /index.php/permalink urls in nginx hhvm 3.21

    Adding this for everyone’s reference:

    location / {
        fastcgi_param  SCRIPT_FILENAME $document_root/index.php$fastcgi_script_name;


    location / {
        rewrite ^/([^.]+)$ /index.php/$1 break;

    Ensure you are using a fastcgi and not a server version (in server version you may get too many redirects due to rewrite)

    • TESTED
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top