Created
August 8, 2018 05:42
-
-
Save wolfeidau/2c449a9cb09495d8e28fcc5d15f64d7b to your computer and use it in GitHub Desktop.
NGINX configuration used to serve an SPA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name localhost; | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
# rely on X-Forwarded-Proto to redirect to HTTPS | |
if ($http_x_forwarded_proto = "http") { | |
return 301 https://$server_name$request_uri; | |
} | |
location / { | |
# serve up index.html for any 404 with the original URI intact | |
try_files $uri $uri/ /index.html; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment