jsjcjsjc
V2EX  ›  问与答

nginx 的端口转发有哪几种办法?

  •  
  •   jsjcjsjc · Jul 13, 2018 · 3337 views
    This topic created in 2881 days ago, the information mentioned may be changed or developed.

    原因是搭建了一个网盘 filebrowser 的端口是 60000,搭配上域名的话想用 80 端口 尝试了下面两段代码,发现其他问题都没有,但是 filebrowser 有个功能是可以执行 shell 命令,发现直接用 60000 端口访问的话没有问题,但是用下面两种办法端口调整后就不能执行 shell 命令了?想问一下还有其他办法吗?

    server {
            listen 80;
            server_name cloud.getpocket.net;
            location / {
                proxy_pass http://127.0.0.1:60000;
            }
        }
    
    upstream filebrowser{
        server 127.0.0.1:60000;
    }
    
    
    
    server {
        listen       80;
        server_name  cloud.getpocket.net;
        
        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://filebrowser;
        }
    }
    
    2 replies    2018-07-13 17:34:23 +08:00
    hxsf
        1
    hxsf  
       Jul 13, 2018   ❤️ 1
    加上 websock 支持 就好了
    jsjcjsjc
        2
    jsjcjsjc  
    OP
       Jul 13, 2018
    @hxsf 感谢,可以了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1253 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 93c8b4a0 · 43ms · UTC 17:41 · PVG 01:41 · LAX 10:41 · JFK 13:41
    ♥ Do have faith in what you're doing.