Custom Nginx Configuration

 

server { listen 80; underscores_in_headers on; location /employee { root /var/web; index index.html index.htm; try_files $uri $uri/ /employee/index.html; } }
  • This location block specifies the “/employee” prefix compared with the URI from the request. For matching requests, the URI will be added to the path specified in the root directive, that is, to /var/web, to form the path to the requested file on the local file system

  • Using try_files means that you can test a sequence. If $uri doesn’t exist, try $uri/, if that doesn’t exist try a fallback location. In this case, if the $uri file exists, serve it. If not, check if that directory exists. If not, then proceed to /employee/index.html which you make sure exists.