Home Server Nginx Solution to: Why won’t my WordPress permalinks work with Nginx?

Get social!

Question: Why won't my WordPress permalinks work with Nginx?

Lately, I've taken a liking to Nginx (as opposed to Apache) for my primary web server. I rent space at rackspace.com, so the less resources my web server uses, the better. Nginx blows Apache away in this department. Still, I miss my Apache sometimes. Like rewrites, for instance.

Htaccess files and RewriteRules are second nature to me. Not so much with Nginx. It took me a couple of tries to get the rewrite syntax down so that I could display permalinks on my site. The site that clued me in is here:


Solution: Use this code in your nginx.conf file:

Note: If your blog isn't set at the root of the website, you'll need to add the root folder to the location directive (like "location /blog/ {..." for instance.

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

Bad Behavior has blocked 36 access attempts in the last 7 days.