Last active
July 26, 2021 11:27
-
-
Save justerror/663c2cec8e0a931f1653990ebb990073 to your computer and use it in GitHub Desktop.
NGINX configuration for Angular app
This file contains hidden or 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 443 ssl http2; | |
| server_name example.com www.example.com; | |
| root /var/www/example.com/dist; | |
| index index.html; | |
| location / { | |
| try_files $uri $uri/ @index; | |
| add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate"; | |
| } | |
| location @index { | |
| try_files /index.html =404; | |
| expires -1; | |
| } | |
| location /index.html { | |
| expires -1; | |
| } | |
| location = /robots.txt { | |
| add_header Content-Type text/plain; | |
| return 200 "User-agent: *\nDisallow:\n"; | |
| } | |
| location ~ "\.[0-9a-f]{8,32}\..*$" { | |
| expires max; | |
| add_header Cache-Control "public, no-transform"; | |
| } | |
| location ~ /\. { | |
| deny all; | |
| } | |
| } | |
| server { | |
| listen 80; | |
| server_name example.com www.example.com; | |
| return 301 https://$host$request_uri; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment