Configuring Clean URLs/Permalinks on Nginx

April 6, 2016 452 views
Nginx MEAN Ubuntu

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?

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:

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.
Have another answer? Share your knowledge.