***之shadowsocks

方法1:自建        

     ##yum install python-devel python-pip -y;pip install shadowsocks

               ##single_user:     /etc/shadowsocks.json             

{

    "server":"0.0.0.0",

    "server_port":8989,

    "local_address":"127.0.0.1",

    "local_port":1080,

    "password":"password",

    "timeout":300,

    "method":"aes-256-cfb",

    "fast_open":false

}

               ##multi_user      /etc/shadowsocks_multi.json

{

        "server":"0.0.0.0",

        "port_password":{

                "8980":"password0",

                "8981":"password1",

                "8982":"password2",

                "8983":"password3",

                "8984":"password4",

                "8985":"password5",

                "8986":"password6",

                "8987":"password7",

                "8988":"password8",

                "8989":"password9"

        },

        "local_address":"127.0.0.1",

        "local_port":1080,

        "timeout":600,

        "method":"aes-256-cfb"

}


               ##supervisor處理demo:http://supervisord.org/configuration.html  

                    supervisor的啓動腳本https://github.com/cedricporter/supervisor_conf/blob/master/init.d/supervisor

                    1.pip install supervisor

                    2.mkdir /etc/supervisor/conf.d -pv

                    3.echo_supervisord_conf > /etc/supervisor/supervisord.conf

                    4.修改supervisor.conf:

                         tail -2 /etc/supervisor/supervisrod.conf

[include]

files = conf.d/*.conf

                    5.supervisor監控地址:server_ip:9001

          

                    [inet_http_server]

                    port=0.0.0.0:9001 

                    username=user     

                    password=1234567890


                    6.配置需要時時監控的命令或腳本:cat /etc/supervisor/conf.d/shadowsocks.conf

[program:shadowsocks]

#numprocs = 2

#numprocs_start = 8850

#process_name = shadowsocks-%(process_num)s

#command = /usr/bin/ssserver -c /etc/shadowsocks.json -d start --port = %(process_num)s


command = /usr/bin/ssserver -c /etc/shadowsocks.json -d start

directory = /tmp

user = nobody

autostart = true

autorestart = true


                    7.啓動supervisord服務器,並下載啓動腳本添加到開機自啓動

                         supervisord  -c /etc/supervisor/supervisord.conf

                         systemctl enable supervisord

                    8.查看監控的腳本和命令

                         supervisorctl -c /etc/supervisor/supervisord.conf

                          supervisorctl >reload | start |help ...... 

                    9.每次修改配置文件supervisord 都要reload


方法2:腳本配置

    1.wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh

chmod +x shadowsocks.sh


    2.執行腳本,根據提示配置

        ./shadowsocks.sh 2>&1 | tee shadowsocks.log

     3.如果需要啓動多端口用戶配置,請參考方法1中shadowsocks_multi.json配置,並修改啓動腳本中默認使用的conf變量的值。

        

grep conf /etc/init.d/shadowsocks 

# chkconfig: 2345 90 10

conf=/etc/shadowsocks.json

#conf=/etc/shadowsocks_multi.json


測試:客戶端可以使用shadowsocks軟件或proxy-swithyOmega

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章