-
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 17 replies
-
Beta Was this translation helpful? Give feedback.
-
老老实实用端口转发吧,Unix Domain Socket的权限问题没必要去折腾,用它带来的所谓性能提升几乎可以忽略不计。 |
Beta Was this translation helpful? Give feedback.
-
我也是在dest到别的网站会反复出现这个报错无法传递到upstream的报错。 |
Beta Was this translation helpful? Give feedback.
-
目前这个错误还在,一直搞不懂什么原因造成的,有懂的麻烦回复一下谢谢。
|
Beta Was this translation helpful? Give feedback.
-
权限设置777试试看? |
Beta Was this translation helpful? Give feedback.
-
建议先不要用 xray 的 或者直接 xray 监听 8443 解君愁,然后再偷自己的证书。 Xiaomage's Blog - 使用Nginx进行SNI分流并完美和网站共存
nginx.conf stream {
map $ssl_preread_server_name $backend_name {
www.abc.com unpack;
...
default default_backend;
}
upstream unpack {
server unix:/dev/shm/nginx/unpack.sock;
}
upstream default_backend {
server unix:/dev/shm/nginx/default_backend.sock;
}
upstream xray {
server unix:/dev/shm/xray_nginx.sock;
}
server {
listen 443 reuseport;
...
proxy_protocol on;
}
server {
listen unix:/dev/shm/nginx/unpack.sock proxy_protocol;
proxy_pass xray;
}
} web.conf # 正常访问 server
server {
listen unix:/dev/shm/nginx/default_backend.sock ssl http2 proxy_protocol;
# http2 on; # 这是 1.25.1 版本的 nginx 开始启用的
set_real_ip_from unix:;
real_ip_header proxy_protocol;
server_name www.abc.com;
# SSL
ssl_certificate /.../fullchain.pem;
ssl_certificate_key /.../privkey.pem;
# web
location / {
...
}
}
# 被自己偷的 server
server {
listen unix:/dev/shm/nginx/nginx_xray.sock ssl http2;
# http2 on; # 这是 1.25.1 版本的 nginx 开始启用的
set_real_ip_from unix:;
server_name www.abc.com;
# SSL
ssl_certificate /.../fullchain.pem;
ssl_certificate_key /.../privkey.pem;
# web
location / {
...
}
}
config.json {
"stats": {},
"log": {
"inbounds": [
{
"listen": "/dev/shm/xray_nginx.sock,0666",
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"dest": "www.abc.com:443",
// "dest": "/dev/shm/nginx_xray.sock", // 偷自己
"xver": 0,
"serverNames": [
"www.abc.com"
]
}
}
}
] |
Beta Was this translation helpful? Give feedback.
-
谢谢 我试了你这个方案,使用的偷自己证书, 能够运行但是还是出现 |
Beta Was this translation helpful? Give feedback.
-
#2754 (reply in thread)
|
Beta Was this translation helpful? Give feedback.
-
使用如下配置解决问题:
nginx配置:
|
Beta Was this translation helpful? Give feedback.
-
找到问题了, stream里的 proxy_half_close on 这个选项,去掉后,基本上没很少出现错误日志 “ writev() failed (32: Broken pipe) while proxying and sending to upstream ”了。 |
Beta Was this translation helpful? Give feedback.
使用如下配置解决问题:
xray配置: