Linux · 5月 6, 2022 0

Nginx转发Socts5

内容纲要

安装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 root@107.72.96.188 -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/

%d 博主赞过: