Title: WordPress Permalinks on NGINX
Last modified: August 21, 2016

---

# WordPress Permalinks on NGINX

 *  [simonnin](https://wordpress.org/support/users/simonnin/)
 * (@simonnin)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/wordpress-permalinks-on-nginx/)
 * I am running 3 WordPress sites on my Webuzo VPS on a LEMP environment.
    I have
   added permalinks from the Admin Portion > Settings >> Permalinks, but my links
   result in a 404 page not found error.
 * I toggled to Apache as the default webserver on the same VPS and the permalinks
   work fine, but I want to use NGINX as the default webserver for my sites.
 * How do I fix this ?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Dave Naylor](https://wordpress.org/support/users/wpranger/)
 * (@wpranger)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/wordpress-permalinks-on-nginx/#post-4793649)
 * Codex page:
 * [http://codex.wordpress.org/Nginx#URL_Rewrites_.2F_Permalinks](http://codex.wordpress.org/Nginx#URL_Rewrites_.2F_Permalinks)
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [12 years, 1 month ago](https://wordpress.org/support/topic/wordpress-permalinks-on-nginx/#post-4793667)
 * WordPress added support for nginx and permalinks in 3.7, so some of that article
   is out of date.
 * However, WordPress won’t write an nginx config file for you, because it doesn’t
   know your setup or where to put the config files. Unlike Apache, an .htaccess
   file in the directory is not quite a standard for nginx.
 * An extensive config file is here:
    [http://codex.wordpress.org/Nginx#General_WordPress_rules](http://codex.wordpress.org/Nginx#General_WordPress_rules)
 * However most of that is really unnecessary for a basic nginx configuration. The
   rule could be as simple as this in the relevant server block:
 *     ```
       location / {
               try_files $uri $uri/ /index.php?q=$request_uri;
       }
       ```
   
 * Everything other than that is more or less prettification or rewrites for personal
   tastes (blocking annoyances, things like that).
 * Dreamhost, for example, recommends something like this:
    [http://wiki.dreamhost.com/Nginx#Permalinks](http://wiki.dreamhost.com/Nginx#Permalinks)
 *     ```
       if (!-e $request_filename) {
         rewrite ^.*$ /index.php last;
       }
       ```
   
 * Which works but might be a tad slower.
 * The rules get more complex for things like multisite and such.
 *  [Thomas040ehv](https://wordpress.org/support/users/thomas040ehv/)
 * (@thomas040ehv)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/wordpress-permalinks-on-nginx/#post-4793981)
 * Where should I put that line of code? (this:
 *     ```
       location / {
               try_files $uri $uri/ /index.php?q=$request_uri;
       }
       ```
   
 * )
 *  [someguy03](https://wordpress.org/support/users/someguy03/)
 * (@someguy03)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/wordpress-permalinks-on-nginx/#post-4793982)
 * [@thomas040ehv](https://wordpress.org/support/users/thomas040ehv/)
 * In your /etc/nginx/sites-available/*configfile*

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WordPress Permalinks on NGINX’ is closed to new replies.

## Tags

 * [apache](https://wordpress.org/support/topic-tag/apache/)
 * [nginx](https://wordpress.org/support/topic-tag/nginx/)
 * [permalink](https://wordpress.org/support/topic-tag/permalink/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 5 participants
 * Last reply from: [someguy03](https://wordpress.org/support/users/someguy03/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/wordpress-permalinks-on-nginx/#post-4793982)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
