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.

This entry was posted in Software. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Trackback

  1. [...] Here is a excellent tutorial show you how to Set WordPress permalinks in subfolder with nginx: 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. [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>