Nginx Rewrite Rule:: index.html added to every permalink

Been working for several hours on getting my WordPress site to run on a secondary VPS with Nginx. Home is loaded and W3T Cache is working OK, but the permalinks are still broken and each one of them leads to a 404:

404 Not Found
nginx/0.8.53

In the error.log I found

Read More
2012/12/22 01:06:16 [error] 16865#0: *2 "/home/user/domain.com/web-development/pdf2html-for-cforms/index.html" is not found (2: No such file or directory), client: 125.25.32.95, server: www.domain.com, request: "GET /web-development/pdf2html-for-cforms/ HTTP/1.1", host: "www.domain.com", referrer: "http://www.domain.com/"

So index.html is still looked for to each permalink it seems..

Here is what I have in /home/user/domain.com/wordpress.conf

    # WordPress single blog rules.
    # Designed to be included in any server {} block.
    
    # This order might seem weird - this is attempted to match last if rules below fail.
    # http://wiki.nginx.org/HttpCoreModule
    location / {
        try_files $

uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
       access_log off; log_not_found off; expires max;
}

which I got from the WordPress Codex. I wanted to run the Nginx Helper which is supposed to help with the WordPress permalink issue on Nginx , but I have PHP 5.2 and 5.3 is needed so I could not and I did not want to compile a new PHP just yet as that is not my field of expertise as of yet.

Does anyone how I can trouble shoot this and get my custom permalink structure /%category%/%postname%/ up and running?

Update

Tried a new wordpress.conf solution from Nginx Library

location / {
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?q=$uri&$args;
}

Still the index.html added. And that url with index.html cannot be found of course. Latest error:

2012/12/22 05:35:54 [error] 28148#0: *64 "/home/user/domain.com/web-development/dreamhost-vps-manager-forced-reboot-issues/index.html" is not found (2: No such file or directory), client: 125.25.32.95, server: www.domain.com, request: "GET /web-development/dreamhost-vps-manager-forced-reboot-issues/ HTTP/1.1", host: "www.domain.com", referrer: "http://www.domain.com/"

Makes you wonder if the config file is loaded or not. How to check this?

Related posts

Leave a Reply

1 comment

  1. Correct rewrite rules for wordpress.conf are:

    location / {
            try_files $uri $uri/ /index.php?q=$uri&$args;
        }
    

    but the main issue was location. I misread at Dreamhost’s wiki where I had to put this wordpress.conf. An awesome lady at Dreamhost explained it to me. I am very grateful for her telling me this oversight! With Dreamhost it has to be put @ /home/user/nginx/domain.com . After that I did a restart as root using /etc/init.d/nginx restart and now the permalinks are purring like a kitten!