nginx and WordPress permalinks in subfolder

I’m playing around with nginx, a light weight http server. One of the first things I tried was to get PHP and WordPress up and running on an Ubuntu 10.4 machine. To do that I followed the following instructions.

First I had to get PHP working so I followed these instructions for PHP-fpm.

The next thing is MySQL and connecting with PHP. This “just worked” after installing php5-mysql.

Finally WordPress which also worked fine – except for permalinks which in the default installation relies on Apache .htaccess redirects. After doing this things sort of worked, but I’m running WordPress in a subfolder (http://localhost/wordpress) so I had to modify the redirect to look like this:

location / {
  root /var/www;
  index index.html index.htm index.php;
  if (!-e $request_filename) {
    rewrite ^.*$ /wordpress/index.php last;

…and now it works with any permalink structures.


One thought on “nginx and WordPress permalinks in subfolder

  1. Pingback: Set WordPress permalinks in subfolder with nginx | Nginx Lighttpd Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *