Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Nginx sample configuration for an Angular Multilingual application
server {
listen 80;
root /var/www/html/my-app/dist;
index index.html index.htm;
location /en/ {
autoindex on;
try_files $uri$args $uri$args/ /en/index.html;
location /es/ {
autoindex on;
try_files $uri$args $uri$args/ /es/index.html;
# Default to EN
location / {
# Autoindex is disabled here + the $uri$args/ is missing from try_files
try_files $uri$args /en/index.html;
# REALLY important for JavaScript modules (type="module") to work as expected!!!
location ~ \.js {
add_header Content-Type text/javascript;

This comment has been minimized.

Copy link
Owner Author

@alex-arriaga alex-arriaga commented Jun 25, 2019

This file should be linked into the "sites-enabled" directory in your Nginx installation:

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
sudo service nginx configtest
sudo service nginx reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.