好了,废话不多,直接切入正题:
通过http://50.tn购买前端后进行部署,然后通过前端搭建已经做完了前端的所有操作,但是光有前端也不够,需要一个后端来做业务支撑,所以我们接下来需要添加节点。
登陆到前端后台,节点-右下角的+号,进行节点添加,务必注意,IP地址需要填写正确,填写为后端节点的IP地址,如图所示:
其他地方根据自己需求添加,然后添加之后,记住节点的ID,后面会需要用到。
我这里添加的是28,记住这个28即可。
然后我们回到终端安装libsodium:
yum -y groupinstall "Development Tools" wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz tar xf libsodium-1.0.16.tar.gz && cd libsodium-1.0.16 ./configure && make -j2 && make install echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf ldconfig
libsodium是给SSR提供chacha20、salsa20、chacha20-ietf等高级加密所必须的扩展库,如果不用这几个加密方式,可以不安装。
然后安装后端:
cd /root yum -y install python-setuptools easy_install pip git clone https://github.com/4kercc/shadowsocks.git cd shadowsocks pip install -r requirements.txt cp apiconfig.py userapiconfig.py cp config.json user-config.json
后端安装后,我们需要进行配置修改:
vi userapiconfig.py
然后根据如图所示修改,这里有两种后端对接方式,我一个个解释:
第一个:数据库对接
数据库对接需要修改的地方:
1.NODE_ID = 这里输入前端的节点UD 2.API_INTERFACE = 'glzjinmod' 务必选择glzjinmod 3.# Mysql下面填写前端的MySQL数据库信息(务必注意,需要打开前端数据库的远程连接) 4.WEBAPI_TOKEN=''这里需要和前端一致,具体在网站目录config/.config.php中查询,前端默认key是NimaQu
这样修改后就可以保存了。
第二个:WEBAPI对接
WEBAPI对接需要修改的地方:
1.NODE_ID = 这里输入前端的节点UD 2.API_INTERFACE = 'modwebapi' 务必选择modwebapi 3.WEBAPI_URL = 'https://ssr.tn' 这里需要把地址改成前端地址,务必区分http和https 4.WEBAPI_TOKEN=''这里需要和前端一致,具体在网站目录config/.config.php中查询,前端默认key是NimaQu
这样修改后就可以保存了。
后端按照上面的修改,已经部署完成了,我们接下来开启后端:
python server.py
启动之后,去前端看一下节点是否在线,如果确定在线,Ctrl+C退出,然后输入下面的脚本后台运行:
chmod +x run.sh ./run.sh
注意:搬瓦工机器由于自己的问题,缺失了pip,需要手动安装一下pip,否则后端无法启动。其他机器可以忽略,有问题了再装这个。
yum -y install python-pip
yum install python-setuptools && easy_install pip
pip install setuptools==33.1.1
执行脚本后,输入pip,能有返回值,即表示pip安装成功,重新去部署后端即可。
这样整个后端就部署完成了,如果需要对后端进行进程守护的话,可以使用nohup或者screen来操作,具体守护过程可以博客搜索相关关键词,这里就不再进行详细解释了。
PS:如果无法看懂教程,或者说教程过于繁琐,可以直接购买后端一键脚本,脚本webapi和数据库对接二选一:http://50.tn
[root@instance-4 shadowsocks]# python server.py
loaded collections.OrderedDict
IPv6 support
Traceback (most recent call last):
File “server.py”, line 33, in
import speedtest_thread
File “/root/shadowsocks/speedtest_thread.py”, line 6, in
import speedtest
ImportError: No module named speedtest
请问这是什么原因呀
loaded collections.OrderedDict
IPv6 support
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib64/python2.7/threading.py”, line 812, in __bootstrap_inner
self.run()
File “server.py”, line 49, in run
self.obj.thread_db(self.obj)
File “/root/shadowsocks/web_transfer.py”, line 638, in thread_db
import webapi_utils
File “/root/shadowsocks/webapi_utils.py”, line 5, in
import requests
File “/usr/lib/python2.7/site-packages/requests-2.25.1-py2.7.egg/requests/__init__.py”, line 43, in
import urllib3
ImportError: No module named urllib3
Exception in thread Thread-2:
Traceback (most recent call last):
File “/usr/lib64/python2.7/threading.py”, line 812, in __bootstrap_inner
self.run()
File “server.py”, line 49, in run
self.obj.thread_db(self.obj)
File “/root/shadowsocks/speedtest_thread.py”, line 165, in thread_db
import webapi_utils
File “/root/shadowsocks/webapi_utils.py”, line 5, in
import requests
File “/usr/lib/python2.7/site-packages/requests-2.25.1-py2.7.egg/requests/__init__.py”, line 43, in
import urllib3
ImportError: No module named urllib3
Exception in thread Thread-4:
Traceback (most recent call last):
File “/usr/lib64/python2.7/threading.py”, line 812, in __bootstrap_inner
self.run()
File “server.py”, line 49, in run
self.obj.thread_db(self.obj)
File “/root/shadowsocks/auto_block.py”, line 279, in thread_db
import webapi_utils
File “/root/shadowsocks/webapi_utils.py”, line 5, in
import requests
File “/usr/lib/python2.7/site-packages/requests-2.25.1-py2.7.egg/requests/__init__.py”, line 43, in
import urllib3
ImportError: No module named urllib3
启动server.py时候显示这个
这个git是用的master还是用dev版
搬瓦工换IP后,以前注册的账号都可以用,后面新注册的都不行。。。
这个需要怎样修改后端?重装一次后端?还是怎样?
大佬你好.
使用一段时间之后(大概几个小时吧),代理连接不上,前端显示后端正常在线。
找不原因在哪儿. 重新搭建了好几次都是这样.
你好,使用WEBAPI对接报错,如下
[root@95 shadowsocks]# python server.py
loaded collections.OrderedDict
IPv6 support
INFO: ShadowsocksR 3.4.0 mod by esdeathlove
INFO: current process RLIMIT_NOFILE resource: soft 65535 hard 65535
ERROR: Traceback (most recent call last):
File “/root/shadowsocks/webapi_utils.py”, line 23, in getApi
timeout=10)
File “/usr/lib/python2.7/site-packages/requests/sessions.py”, line 501, in get
return self.request(‘GET’, url, **kwargs)
File “/usr/lib/python2.7/site-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python2.7/site-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python2.7/site-packages/requests/adapters.py”, line 423, in send
timeout=timeout
File “/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py”, line 345, in _make_request
self._validate_conn(conn)
File “/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py”, line 844, in _validate_conn
conn.connect()
File “/usr/lib/python2.7/site-packages/requests/packages/urllib3/connection.py”, line 333, in connect
cert = self.sock.getpeercert()
File “/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py”, line 343, in getpeercert
‘subjectAltName’: get_subj_alt_name(x509)
File “/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py”, line 219, in get_subj_alt_name
for name in ext.get_values_for_type(x509.DNSName)
File “/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py”, line 175, in _dnsname_to_stdlib
name = idna_encode(name)
File “/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py”, line 167, in idna_encode
import idna
ImportError: No module named idna
你好 安装之后图标变绿了 但是我的订阅地址不能用是w1.com开头的,电脑端手机端都订阅不了。请问是什么问题呢
我之前用的是十一博客的ss-panel-v3-mod_Uim 一键搭建脚本 for Centos 7.x的一键脚本。
我想改你的可以改么,我数据库可以后面直接添加进去不
https://github.com/glzjin/shadowsocks.git
这个库没了吧
这个github是空的吧