Nginx转发Socts5

Published on Aug. 22, 2023, 12:11 p.m.

安装nginx

yum install nginx

stream {

    #......

    upstream local-proxy  {
        server 127.0.0.1:8119; #union-proxy
        server 127.0.0.1:8120; #union-proxy
        server 127.0.0.1:8121; #union-proxy
        server 127.0.0.1:8122; #union-proxy
        #ip_hash在stream中是不支持的
    }

    server {
        listen 8118;
        #server_name也没有;
        proxy_pass local-proxy;

    }
    #......
}

测试效果

curl -x 127.0.0.1:8118 http://icanhazip.com
curl -I -x socks5://127.0.0.1:8118 https://www.google.com

# 开放防火墙
firewall-cmd --zone=public --add-port=8118/tcp --permanent
service nginx restart

将端口映射到本地

ssh [email protected] -R8118:localhost:54321

Turn any Linux computer into a SOCKS5 proxy with one command
https://catonmat.net/linux-socks5-proxy

用Nginx为多个http/socks代理做负载均衡(反向代理)
https://www.cnblogs.com/qjfoidnh/p/11633300.html

https://sulangsss.github.io/2017/10/18/Nginx/forward-socts5/

Tags: