-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
39 lines (36 loc) · 963 Bytes
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
## redirect www
server {
root /var/www;
index index.html;
listen 80 default_server;
server_name _;
server_tokens off;
client_max_body_size 0;
send_timeout 900;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
# remove trailing slash
rewrite ^/(.*)/$ /$1 permanent;
# Add 1 day expires header for static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|mp4|ogg|webm)$ {
expires 1d;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to redirecting to index.html
# auth_basic "Restricted"; #For Basic Auth
# auth_basic_user_file /etc/nginx/.htpasswd; #For Basic Auth
try_files $uri $uri/index.html /index.html;
}
location ~ \.html$ {
try_files $uri @root;
}
location @htmlext {
rewrite ^(.*)$ $1.html last;
}
# If nginx can't find a file, fallback to the homepage.
location @root {
rewrite .* / redirect;
}
}