-
Notifications
You must be signed in to change notification settings - Fork 0
/
book.conf
45 lines (40 loc) · 1.03 KB
/
book.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
server {
listen 8080;
server_name localhost;
root /root;
location = / {
root /root/_book;
try_files /_book/assets$uri /_book/assets$uri/index.html;
}
location ~ \.(woff2|woff|ttf|css|js)$ {
root /root/_book;
try_files $uri @en;
}
location @en {
root /root/_book_en;
}
location ^~ /zh-cn {
alias /root/_book;
if ($request_uri ~ ^([^.\?]*(?<!\.css|\.js|\.html|\.ico|/)$)) {
return 301 $1/;
}
index index.html index.htm;
}
location ^~ /en {
alias /root/_book_en;
if ($request_uri ~ ^([^.\?]*(?<!\.css|\.js|\.html|\.ico|/)$)) {
return 301 $1/;
}
index index.html index.htm;
}
location @rewrite {
rewrite ^.*\/zh-cn\/(.*)/.+ /root/_book/$1/ last;
}
location @rewrite {
rewrite ^.*\/en\/(.*)/.+ /root/_book_en/$1/ last;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}