Shadowsocks Command Client安装
1 2 3 4 |
安装shadowsocks后输入sslocal

配置shadowsocks
1 2 3 |
sslocal -s <美国IP> -p <美国端口> -k <密码> -m <加密方式> -l <本地端口> # 例如: sslocal -s 107.167.191.85 -p 8989 -k "sdfsdfsdfsdfsdfsdfsf" -l 1080 -t 600 -m aes-256-cfb |
运行:
使用配置文件启动shadowsocks
首先找个安全的地方编写一个配置文件,叫做shadowsocks.json
,内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
{ "server":"11.22.33.44", "server_port":9999, "local_port":1080, "password":"balabala", "timeout":600, "method":"aes-256-cfb" } server:服务器地址 server_port:服务器端口 local_port:本地端口 password:密码 timeout:延时 method:加密方式 |
然后使用如下命令就可以启动shadowsocks
1 |
sslocal -c /home/fullpath/shadowsocks.json |
至此,shadowsocks终于启动了,好像也没什么曲折的经历,但是,你以为这样就能上网了吗?native
配置github加速:
1 2 3 4 5 6 7 8 |
#在git config全局配置代理端口 git config --global http.proxy socks5://127.0.0.1:1080 git config --global https.proxy socks5://127.0.0.1:1080 #取消git config配置: git config --global http.proxy "" git config --global https.proxy "" |
测试一下吧:
完善一下shadowsocks
的启动吧
如果你重启服务器,或者其他的状况,服务可能就不生效了,怎么办?
安装supervisor
1 2 3 4 5 6 |
[root@blog-seo vhost]# yum install supervisor 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * ius: mirrors.tuna.tsinghua.edu.cn 软件包 supervisor-3.1.4-1.el7.noarch 已安装并且是最新版本 无须任何处理 |
安装好之后我们可以在/etc/supervisord.d/下新建个文件比如 shadowsocks.conf 然后加入以下内容:
1 2 3 4 5 6 7 8 9 |
[program:socks] command=sslocal -c /home/fullpath/shadowsocks.json directory=/srv/www autostart=true autorestart=true user=root log_stderr=true logfile=/var/log/shadowsocks.log 其中,进程shadowsocks定义在[program:shadowsocks]中,command是命令,directory是进程的当前目录,user是进程运行的用户身份。 |
command后面要接上正确的shadowsocks.json的路径,我这就是打个比方。
1 2 |
[root@blog-seo supervisord.d]# supervisorctl start socks socks: started |
