CentOS 安装代理服务器
安装socks5代理
安装方法
sudo yum install -y gcc openldap-devel pam-devel cyrus-sasl-devel openssl-devel
wget http://jaist.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
tar -vzx -f ss5-3.8.9-8.tar.gz
cd ss5-3.8.9/
./configure && make && sudo make install
编辑vim /etc/opt/ss5/ss5.conf
,去掉下面两行的注释
auth 0.0.0.0/0 - -
permit - 0.0.0.0/0 - 0.0.0.0/0 - - - - -
默认是无密码,若要使用用户认证,将这两行改为
auth 0.0.0.0/0 - u
permit u 0.0.0.0/0 - 0.0.0.0/0 - - - - -
编辑/etc/opt/ss5/ss5.passwd
,添加用户名和密码
username password
编辑/etc/sysconfig/ss5
,将SS5这一行改为
SS5_OPTS=" -u root -b 0.0.0.0:10808"
编辑/etc/sysconfig/iptables
,打开端口10808。
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10808 -j ACCEPT
然后启动ss5
chmod a+x /etc/init.d/ss5
/etc/init.d/ss5 start
添加开机启动
chkconfig --level 345 ss5 on
使用nginx设置http代理
配置
server {
resolver 8.8.8.8;
resolver_timeout 5s;
listen 0.0.0.0:50188;
location / {
proxy_pass $scheme://$host$request_uri;
proxy_set_header Host $http_host;
# proxy_buffers 256 4k;
# proxy_max_temp_file_size 0;
proxy_connect_timeout 30;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 301 1h;
proxy_cache_valid any 1m;
}
}