1
0
1Panel-Appstore/apps/amprobe/latest/data/nginx/nginx.conf

54 lines
1.4 KiB
Nginx Configuration File
Raw Normal View History

2024-05-10 23:54:24 +08:00
worker_processes 1;
daemon off;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
2024-05-11 00:05:23 +08:00
listen 40235;
2024-05-10 23:54:24 +08:00
#server_name amprobe.amuluze.com; # 服务器地址或绑定域名
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api/ {
rewrite ^/api/(.*)$ /$1 break; #必须的写这个使用nginx的rewrite对uri进行重写 下面这行也要改为api
proxy_pass http://127.0.0.1:8000/; #跨域转发路由地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /ws/ {
# rewrite ^/wsUrl/(.*)$ /$1 break; #拦截标识去除
proxy_pass http://127.0.0.1:8000/ws/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# 错误页配置
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}