Nginx is a popular web server that can be used to serve static HTML pages. This article will show you how to respond to all Nginx requests with a static HTML page. First, create a new file in your project’s root directory called nginx.conf. This file contains the configuration for your web server. In this file, you will need to set up some basic settings, such as the port on which your web server should listen, and the path to your nginx executable. Next, add the following line to your nginx.conf file: server { listen 80; } This line tells Nginx that it should listen on port 80 for requests from clients. You can also set up Nginx to listen on other ports if you want, but this is not recommended because it can cause problems when trying to serve pages that require access from multiple ports. Next, add the following line to your index.html file:Nginx Static Page


So once we got into the HSTS preload list, nobody could to go http://feeds.howtogeek.com anymore, and Feedburner’s custom DNS option didn’t support HTTPS. So it was time to switch to our own thing.

The quick and easily solution was to serve up all requests to a static copy of our RSS feed that we had stored in the index.html file. To force nginx to serve that file whether somebody went to /howtogeek/ or /howtogeek/1 or even /howtogeek1 was as simple as using the try_files directive.

You’ll just want to edit your server or location block with try_files like this:

Replace the /index.html part with whatever your static HTML page is. Once you’re done you’ll have a block kinda like this, which will send every request to the file index.html which should be found in the root directory, in this case /data/webroots/feeds/.

Restart nginx with a

command, and you’re all set.