Skip to content

Instantly share code, notes, and snippets.

@badouralix
Last active October 21, 2017 17:09
Show Gist options
  • Save badouralix/643891be525b3e0eac7f865bfacb9fc1 to your computer and use it in GitHub Desktop.
Save badouralix/643891be525b3e0eac7f865bfacb9fc1 to your computer and use it in GitHub Desktop.
Docker nginx:alpine configuration for vue-router in HTML5 mode
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite ^(.+)$ /index.html last;
}
# Some basic cache-control for static files to be sent to the browser
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# Redirect server error pages to the static page /50x.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