Configuring Clean URLs/Permalinks on Nginx

Posted April 6, 2016 4.6k views

I am using NGINX to serve my static files generated from Harp JS. The site is at How do I configure NGINX to recognize and “play nice” w/ clean URLs/permalinks?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

If you’re looking for Nginx to respond to requests without the html file extension, add a location block to your Nginx configuration with a try_files directive like the one below:

    location / {
                try_files $uri $uri/ $uri.html;

For more information on how the try_files directive works, check out this tutorial:

by Justin Ellingwood
Nginx is one of the most popular web servers in the world. In this guide, we will discuss how Nginx selects the server and location block that will handle a given client's request. We will go over the algorithm in place, as well as the directives and options you can use to modify the selection process.