mirror of
https://github.com/lush2020/edgetunnel.git
synced 2026-03-22 01:22:21 +08:00
54 lines
1.2 KiB
Plaintext
54 lines
1.2 KiB
Plaintext
user root;
|
|
worker_processes auto;
|
|
|
|
error_log stderr;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
access_log /dev/stdout;
|
|
server_tokens off; # Hide nginx version in Server header & page footers
|
|
|
|
# include /etc/nginx/conf.d/*.conf;
|
|
|
|
server {
|
|
listen $PORT;
|
|
|
|
#charset koi8-r;
|
|
#access_log /var/log/nginx/host.access.log main;
|
|
|
|
location / {
|
|
root /root/html;
|
|
index index.html index.htm;
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /root/html;
|
|
}
|
|
|
|
location /ws { # 与 V2Ray 配置中的 path 保持一致
|
|
if ($http_upgrade != "websocket") { # WebSocket协商失败时返回404
|
|
return 404;
|
|
}
|
|
proxy_redirect off;
|
|
proxy_pass http://127.0.0.1:8080; # 假设WebSocket监听在环回地址的10000端口上
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
# Show real IP in v2ray access.log
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|