-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnginx.conf
36 lines (32 loc) · 1 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
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80; # 监听端口
server_name star-angry.mofengfeng.com; # 域名
location / {
root /var/www/html; # 项目路径
index index.html index.htm; # 默认首页
try_files $uri $uri/ /index.html; # 重定向
}
# 配置反向代理
location /api {
proxy_pass http://127.0.0.1:7788; # 代理地址
proxy_set_header Host $host; # 设置请求头
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 配置websocket
location /ws {
proxy_pass http://127.0.0.1:7788; # 代理地址
proxy_http_version 1.1;
proxy_read_timeout 300s;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $proxy_host;
proxy_set_header X-Real-IP $remote_addr;
}
}