Created
August 16, 2017 15:01
-
-
Save sergeioff/de7eeff3cc9295b48bdfe7cd6d1f6743 to your computer and use it in GitHub Desktop.
Nginx configuration for angular
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
root /var/www/html/; | |
# Add index.php to the list if you are using PHP | |
index index.html index.htm index.nginx-debian.html; | |
server_name _; | |
location ~ ([^\/]+)(?=\/.\.js$|\.js$){ | |
try_files $uri $uri/ /ui/$1.js; | |
} | |
location ~ ([^\/]+)(?=\/.\.svg$|\.svg$){ | |
try_files $uri $uri/ /ui/$1.svg; | |
} | |
location ~ ([^\/]+)(?=\/.\.eot$|\.eot$){ | |
try_files $uri $uri/ /ui/$1.eot; | |
} | |
location ~ ([^\/]+)(?=\/.\.ico$|\.ico$){ | |
try_files $uri $uri/ /ui/$1.ico; | |
} | |
location ~ ([^\/]+)(?=\/.\.woff2$|\.woff2$){ | |
try_files $uri $uri/ /ui/$1.woff2; | |
} | |
location ~ ([^\/]+)(?=\/.\.ttf$|\.ttf$){ | |
try_files $uri $uri/ /ui/$1.ttf; | |
} | |
location ~ ([^\/]+)(?=\/.\.woff$|\.woff$){ | |
try_files $uri $uri/ /ui/$1.woff; | |
} | |
location ~ ([^\/]+)(?=\/.\.map$|\.map$){ | |
try_files $uri $uri/ /ui/$1.map; | |
} | |
location ~ assets(.*) { | |
try_files $uri $uri/ /ui/assets/$1; | |
} | |
location ~ ^/ui { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
expires -1; | |
add_header Pragma "no-cache"; | |
add_header Cache-Control "no-store, no-cache, must-revalicate, post-check=0 pre-check=0"; | |
try_files $uri $uri/ /ui/index.html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment