38 lines
1.3 KiB
Plaintext
38 lines
1.3 KiB
Plaintext
# 此配置针对docker中的nginx
|
||
server {
|
||
listen 80;
|
||
server_name hccz.pcxbc.com;
|
||
root /usr/share/nginx/html;
|
||
index index.php index.html index.htm;
|
||
access_log /dev/null;
|
||
error_log /var/log/nginx/default.error.log warn;
|
||
|
||
# redirect server error pages to the static page /50x.html
|
||
#
|
||
#error_page 500 502 503 504 /50x.html;
|
||
|
||
location / {
|
||
root /usr/share/nginx/html;
|
||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||
# 解决刷新之后404问题
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
|
||
|
||
location /api {
|
||
#如果服务器要获取客户端真实IP,可以用下三句设置主机头和客户端真实地址
|
||
proxy_set_header Host imd.pcxbc.com;
|
||
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;
|
||
# rewrite ^/api/(.*)$ /$1 break; #重写
|
||
proxy_pass http://imd.pcxbc.com; #ybdevicev2是docker中的服务名称,这里不能直接放域名,要么是docker名称,要么是ip+端口的形式
|
||
}
|
||
location /hubs/ {
|
||
proxy_pass http://imd.pcxbc.com;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection "upgrade";
|
||
#proxy_read_timeout 600s;#设置websocket超时时间
|
||
}
|
||
} |