v2fly / v2ray-examples

v2ray-core 的模板们
2.35k stars 740 forks source link

VLESS over TCP with TLS + 回落(最强配置) 更新为VLESS 1.5后 nginx 反代其它网站,不能打开了 #22

Closed ghost closed 4 years ago

ghost commented 4 years ago

升级了VLESS 1.5

nginx 配置为 user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" ' '$proxy_protocol_addr:$proxy_protocol_port'; access_log /var/log/nginx/access.log main; error_log /var/log/nginx/error.log; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; gzip on; gzip_disable "msie6";

server {
    listen       [::]:80 default ipv6only=off;
    return       301 https://$http_host$request_uri;
}

server {
    listen       unix:/dev/shm/default.sock proxy_protocol;
    listen       unix:/dev/shm/h2c.sock http2 proxy_protocol;
    set_real_ip_from 127.0.0.1;
    location / {
        proxy_pass http://www.lovelive-anime.jp/;
    }
    error_page 404 /404.html;
        location = /40x.html {
    }
    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}

}

反代网站为http://www.lovelive-anime.jp/ 在VLESS1.3时,按当时 nginx配置我自己改好,访问我的域名,就能正常反代。今天升级后,访问域名就不行了。v2ray vless是正常工作的。

RPRX commented 4 years ago

提供下 v2ray 配置。

ghost commented 4 years ago

提供下 v2ray 配置。

{ "log": { "loglevel": "warning" }, "inbounds": [ { "port": 443, "protocol": "vless", "settings": { "clients": [ { "id": "***", "level": 0 } ], "decryption": "none", "fallbacks": [ { "dest": "/dev/shm/default.sock", "xver": 1 }, { "alpn": "h2", "dest": "/dev/shm/h2c.sock", "xver": 1 } ] }, "streamSettings": { "network": "tcp", "security": "tls", "tlsSettings": { "alpn": [ "h2", "http/1.1" ], "certificates": [ { "certificateFile": "/etc/ssl/private/loveliveallstar.cer", "keyFile": "/etc/ssl/private/loveliveallstar.key" } ] } } } ], "outbounds": [ { "protocol": "freedom" } ] }

RPRX commented 4 years ago

试试 reboot。

ghost commented 4 years ago

我试过reboot许多次了,都是不行

chrome访问我的域名

显示是

无法访问此网站*** 意外终止了连接。 请试试以下办法:

检查网络连接 检查代理服务器和防火墙 运行 Windows 网络诊断

ERR_CONNECTION_CLOSED

RPRX commented 4 years ago

确定 nginx 正常运行吗?

ghost commented 4 years ago

确定 nginx 正常运行吗?

我用nginx -t命令测试了 nginx 配置文件是显示OK的 然后用reboot重启,让配置文件生效。再访问我的域名,就那样打不开。

我用http 访问域名,能正常跳转到https上。我觉得nginx服务应该是正常的。

我打了systemctl status nginx 命令看nginx应该正常工作的中。

root@host:~# systemctl status nginx ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2020-09-05 11:32:33 EDT; 2min 19s ago Docs: man:nginx(8) Process: 607 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Process: 583 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 608 (nginx) Tasks: 2 (limit: 564) CGroup: /system.slice/nginx.service ├─608 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; └─609 nginx: worker process

Sep 05 11:32:33 host.localdomain systemd[1]: Starting A high performance web server and a reverse proxy server... Sep 05 11:32:33 host.localdomain systemd[1]: Started A high performance web server and a reverse proxy server.

RPRX commented 4 years ago

试试去掉这一行 set_real_ip_from 127.0.0.1;

如果仍然不行的话,试试两个 listen 分开写

RPRX commented 4 years ago

(删除了一条重复的配置信息,比较长

ghost commented 4 years ago

试试去掉这一行 set_real_ip_from 127.0.0.1;

如果仍然不行的话,试试两个 listen 分开写

不好意思。我查到原因了。

先谢谢大佬深夜这么快的回复。

原因是我忘记更新服务器上的V2ray为4.27.5了。 只修改了nginx和v2ray的配置文件。

解决了。再次感谢大佬。你的配置文件没问题。