Make 1 root file accessible, and serve it for all requests

Jonah nginx-forum at
Mon Oct 21 10:23:53 UTC 2013


Thanks very much!  That was incredibly helpful.  I had to make a couple
minor tweaks to get it working, and I wanted a 302 instead of a 301, but the
following is what I ended up with, and it had the added benefit of cutting
response time almost in half when I did a load test:

server {
  listen 80;

  root /var/www/register;

  location = /index.html {

  # Default location, request will fallback here if none other
  # location block matches
  location / {
    rewrite ^.*$ /index.html redirect; # 'root' location '/'

  location /css/ {

  location /js/ {


Posted at Nginx Forum:,243881,243893#msg-243893

More information about the nginx mailing list