0%

nginx反向代理

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
server {
listen 80;
server_name localhost www.jxs17.com jxs17.com;
#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root web;
index index.html index.htm;
}
# 把/api的接口重定向到8081端口
location /api/ {
proxy_pass http://127.0.0.1:8081/;
}

# 把以admin开头的接口,定位到admin这个包下
location /admin {
alias admin;
index index.html index.htm;

}
# 把www重定向到不加www
if ($http_host !~ "^jxs17.com$") {
rewrite ^(.*) http://jxs17.com$1 permanent;

}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}