Can not make WordPress pretty permalinks work (404 error)

I’ve tried to follow the guide at

as suggested in the post
Re: Wordpress Permalinks , but it
still doesn’t work. I’ve copied and replaced the server settings from
the guide, and changed the parts pertaining to my server.

Any permalink setting other than default results in a 404 error page
when accessing the permalink. The permalinks all have the form
http://wp.dev/sitename/sample-page. There’s no structure created for the
tags month, year etc. in the url.

Could someone please help me?

Posted at Nginx Forum:

On Wed, May 9, 2012 at 6:50 PM, seron [email protected] wrote:

tags month, year etc. in the url.

This may be able to help (my wordpress config).

location / {
root /home/edho/sites/animebsd.net;
index index.php;
try_files $uri $uri/ /index.php?q=$uri&$args;
expires max;
location ~ .php$ {
expires off;
try_files $uri =404;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
fastcgi_pass unix:/tmp/.php.sock-edho;
}
}

On Wed, May 9, 2012 at 8:51 PM, seron [email protected] wrote:

For example the WordPress sample page can have either of these two
permalinks, depending on if permalinks are set to default or something
else:

http://wptest.dev/?page_id=2 (default permalink setting)
http://wptest.dev/index.php/sample-page/ (any other permalink setting)

Remove the /index.php part unless you really love it (I don’t) - which
then this additional config is needed:

location /index.php/ {
rewrite ^/index.php/(.+)$ /index.php?q=$1&$args;
}

Make sure to put it before “location /” block.

I made a fresh install of WordPress in a new directory and made a
separate server section in nginx.conf for it.

I tired what you suggested, but to no avail. There’s a small change
which is that I don’t get a 404 error any more and the page is
displayed. My guess is that it’s a different problem present in my
original WordPress installation which is not present in the new one.

The problem with the pretty permalinks still remains however.

For example the WordPress sample page can have either of these two
permalinks, depending on if permalinks are set to default or something
else:

http://wptest.dev/?page_id=2 (default permalink setting)
http://wptest.dev/index.php/sample-page/ (any other permalink setting)

My server section in nginx.conf looks like this following your
suggestion:

server {
listen 80;
server_name wptest.dev;
root /var/www/localhost/wptest;

   index index.php;

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

   location ~ \.php$ {
            expires off;
            try_files $uri =404;
            include fastcgi_params;
            fastcgi_pass localhost:65500;
            fastcgi_param SCRIPT_FILENAME $request_filename;
   }

}

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,226209,226215#msg-226215

That’s interesting. It doesn’t remove the index.php part. I’ve tried
both first and last. Very odd.

Posted at Nginx Forum:

I’ve discovered something interesting. Permalinks works as expected for
posts but not for pages. I’ve been trying all along with pages. Are
pretty permalinks not supposed to work with pages?

Posted at Nginx Forum:

Sorry to jump in here, but I was led to believe that the order of blocks
in
the configuration file didn’t matter. If it does matter, then this wiki
article needs updating: http://wiki.nginx.org/HttpCoreModule#location

"Note that you could define these 4 configurations in any order and the
results would remain the same. "

On Wed, May 9, 2012 at 9:33 PM, seron [email protected] wrote:

The location clause you suggested didn’t cut out the index.php part, but
a WordPress plugin called “nginx compatibility” did.

The location block I suggested is to handle permalinks with
/index.php/. To remove it you can just modify the permalink structure
in wordpress’ options page.

The location clause you suggested didn’t cut out the index.php part, but
a WordPress plugin called “nginx compatibility” did.

Posted at Nginx Forum: