v2fly / v2ray-step-by-step

This repo is a fork of ToutyRater/v2ray-guide, we aim to provide a new step-by-step guide of v2ray
https://guide.v2fly.org
Creative Commons Attribution 4.0 International
753 stars 426 forks source link

建议“TCP+TLS分流器“一节加入使用额外web服务器进行http重定向至https的说明 #158

Open phlinhng opened 4 years ago

phlinhng commented 4 years ago

对于单纯想要配置静态伪装站的用户,TLS分流器内置的静态服务器己经足够。但是TLS分流器没法处理http自动重定向到https,引入额外的web服务器监听80端口的http请求可以解决。
nginx配置文件示例

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name example.com;
    return 301 https://example.com$request_uri;
}

如此一来无论访问example.comhttp://example.comhttps//example.com都可以直接显示页面,更像一个正常的网站。为什么不用nginx做为伪装站的web服务器而只用来处理80端口的转发 ?一来这样不用更动原本教程里写的TLS分流器配置文件,nginx的配置也会比较简单,但是做出来的伪装站效果一样;二来若用户有更多的web服务器需求应该有能力自行阅读分流器的文件写出他们需要的配置,也不需要看这篇教程。