Skip to content

nginx配置

Jrohy edited this page Apr 23, 2020 · 10 revisions

假如想通过nginx来通过不同的请求路径转发进去trojan web管理后台, nginx使用80端口, trojan管理程序使用其他端口(参考修改端口: https://github.com/Jrohy/trojan/wiki/%E4%BF%AE%E6%94%B9web%E7%AB%AF%E5%8F%A3)

假定请求web后台的访问路径为/admin, 启动端口为81,这里提供基本的nginx proxy_pass例子仅供参考:

        location /admin {
            proxy_pass   http://localhost:81/;
        }
        location ~* ^/(js|css|vendor|common|auth|trojan)/ {
            proxy_pass  http://localhost:81;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_set_header Host $host;
        }
Clone this wiki locally