-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathnginx.conf
50 lines (40 loc) · 1.14 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
# Log to stdout
access_log /dev/stdout;
error_log /dev/stderr info;
root /srv;
index index.html;
# Send everything to index.html, if it doesn't exist
location / {
try_files $uri /index.html;
}
# Show commit-id
add_header x-vcs-revision ~REVISION_ID~ always;
add_header x-hostname $hostname always;
# Remove index or index.html from URIs
if ($request_uri ~ ^.*/index$) {
rewrite ^(.*/)index$ $1 permanent;
}
if ($request_uri ~ ^.*/index.html$) {
rewrite ^(.*/)index.html$ $1 permanent;
}
# Remove .html from URIs
if ($request_uri ~ ^.*\.html$) {
rewrite ^(.*)\.html$ $1 permanent;
}
# Remove slashes form URIs if it's not a directory
if (!-d $request_filename) {
rewrite ^/(.*)/$ /$1 permanent;
}
# Add slashes from URIs if it's a directory
if (-d $request_filename) {
rewrite ^/(.*[^/])$ /$1/ permanent;
}
location /_status/check {
return 200 'OK';
add_header Content-Type text/plain;
}
}