mirror of
https://github.com/lush2020/edgetunnel.git
synced 2026-03-23 16:38:34 +08:00
support fallback website
This commit is contained in:
57
nginx.template.conf
Normal file
57
nginx.template.conf
Normal file
@@ -0,0 +1,57 @@
|
||||
user root;
|
||||
worker_processes 4; # Heroku dynos have at least four cores.
|
||||
|
||||
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;
|
||||
|
||||
# 用来proxy https nginx 暂时不支持proxy pass http2.0, 但是可以用SIN 来route
|
||||
# location /dash/ {
|
||||
# proxy_pass https://dash.zizi.press:4000/;
|
||||
# }
|
||||
location / {
|
||||
root /root/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /root/html;
|
||||
}
|
||||
|
||||
location /v2ws { # 与 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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user