好吧,这个502错误与这里的其他相关文章不同。首先我设法使用ubuntu 22设置了一个v2 ray系统。我有一个域和一个cloudflare帐户来为我的域和连接到我的服务器IP的“子”子域设置DNS,所有设置都应该如此。配备了SSL证书和密钥使用certbot在linux上和工作正常,网站来了https刚刚好.在CF(CloudFlare)中启用了dns代理和WebSocket检查。我也在使用反向DNS,就像著名的教程所说的那样,所以我编辑了/etc/nginx/sites-available/sub.domain.com,变成这样:
server {
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name sub.domain.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location /subf1 {
if ($http_upgrade != "websocket") {
return 404;
}
location ~ /subf1/\d\d\d\d\d$ {
if ($request_uri ~* "([^/]*$)" ) {
set $port $1;
}
proxy_redirect off;
proxy_pass http://127.0.0.1:$port/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
return 404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem; # mana>
ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem; # ma>
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = sub.domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name sub.domain.com;
return 404; # managed by Certbot
}
此外,安装了x-ui v2 ray面板,一切都设置得很好,这里是一个示例vless连接,我以前经常创建它,直到昨天都工作得很好:
9988端口是从服务器上的X-UIV 2 Ray管理面板定义的。
一切都很好,直到我删除了x-ui面板并安装了另一个版本。从那时起,我无法使连接工作,无论v2 ray客户端给出这一系列错误:
app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://<ip>/subf1/40234): 502 Bad Gateway > websocket: bad handshake] > common/retry: all retry attempts failed
proxy/http: failed to read response from 149.xx.xx.xx:80 > io: read/write on closed pipe
为了解决这个问题,我做了一些事情:
- 重新启动nginx
- 重新启动服务器
- 重新安装x-ui面板(各种版本)
- 重建服务器
- 更改子域
- 更改子域+更改服务器并获取不同的IP
SSL设置得很好,CF SSL选择为Full。
任何形式的帮助和建议是如此感激。
1条答案
按热度按时间efzxgjgh1#
好吧,这是一个问题,从CDN IP中使用的连接入站。