这是一个
涨姿势的站点

SSR魔改后端配置教程

相关

此为一键脚本后端的手动搭建版本

第一步、安装基本组件和SSR后端

yum -y install python-setuptools && easy_install pip && pip install cymysql speedtest-cli && yum install git

第二步、CHACHA20加密方式支持:

yum -y groupinstall "Development Tools" && wget https://raw.githubusercontent.com/mmmwhy/ss-panel-and-ss-py-mu/master/libsodium-1.0.13.tar.gz&&tar xf libsodium-1.0.13.tar.gz && cd libsodium-1.0.13&&./configure && make -j2 && make install&&echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf&&ldconfig&& rm -rf /root/libsodium-1.0.13.tar.gz && cd /root

第三步、下载程序源代码

git clone -b manyuser https://github.com/glzjin/shadowsocks.git
yum -y install python-devel
yum -y install libffi-devel
yum -y install openssl-devel
cd shadowsocks
pip install -r requirements.txt
cp apiconfig.py userapiconfig.py
cp config.json user-config.json

这里为止,之前的操作通过一键脚本即可完成

配置userapiconfig.py

  • 公用数据库
#节点ID-和你网站添加的节点分配的ID一致!
NODE_ID = 3
#这里必须填,要么选择数据库要么选择httpapi(大多数使用的是数据库,httpapi不知怎么弄,2333)
API_INTERFACE = 'glzjinmod' #glzjinmod (数据库方式连接),modwebapi (http api)
# Mysql 数据库连接信息
MYSQL_HOST = '127.0.0.1'
MYSQL_PORT = 3306
MYSQL_USER = 'ss'
MYSQL_PASS = 'ss'
MYSQL_DB = 'shadowsocks'
MYSQL_UPDATE_TIME = 60

glzjinmod即为公用数据库模式

  • api接口对接
#节点ID-和你网站添加的节点分配的ID一致!
NODE_ID = 3
#这里必须填,要么选择数据库要么选择httpapi(大多数使用的是数据库,httpapi不知怎么弄,2333)
API_INTERFACE = 'modwebapi' #glzjinmod (数据库方式连接),modwebapi (http api)
WEBAPI_URL = 'http://for.mss.me'
WEBAPI_TOKEN = 'mupass'

这里也就是一键脚本为什么需要输入NODE_IDWEBAPI_URLWEBAPI_TOKEN的原因,脚本默认使用api进行对接,这样数据库可以不必暴露在公网。

测试运行

python server.py

测试一下,应该就可以用看到相应用户数据了。
ctrl + c退出,然后./logrun.sh运行即可

参考

SSR魔改后端安装过程


致谢~

可以转载,注明出处。91vps » SSR魔改后端配置教程

评论 31

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #18

    肥羊大佬 你的一键脚本 后端有问题了 安装缺失很多文件

    元太2个月前 (05-02)回复
  2. #17

    SSPANEL+SSR一键脚本如何进行SSL加密呢,整个项目放在了default里面,nginx里没有配置文件啊

    R1N6个月前 (12-19)回复
  3. #16

    2017-11-21 04:29:19 ERROR db_transfer.py:870 Traceback (most recent call last):
    File “/root/shadowsocks/db_transfer.py”, line 862, in thread_db
    db_instance.push_db_all_user()
    File “/root/shadowsocks/db_transfer.py”, line 288, in push_db_all_user
    self.update_all_user(dt_transfer)
    File “/root/shadowsocks/db_transfer.py”, line 79, in update_all_user
    charset=’utf8′)
    File “/usr/lib/python2.7/site-packages/cymysql/init.py”, line 85, in Connect
    return Connection(*args, **kwargs)
    File “/usr/lib/python2.7/site-packages/cymysql/connections.py”, line 244, in __init__
    self._connect()
    File “/usr/lib/python2.7/site-packages/cymysql/connections.py”, line 411, in _connect
    self._get_server_information()
    File “/usr/lib/python2.7/site-packages/cymysql/connections.py”, line 512, in _get_server_information
    packet = MysqlPacket(self)
    File “/usr/lib/python2.7/site-packages/cymysql/packet.py”, line 67, in __init__
    raise_mysql_exception(self.__data)
    File “/usr/lib/python2.7/site-packages/cymysql/err.py”, line 142, in raise_mysql_exception
    _check_mysql_exception(errinfo)
    File “/usr/lib/python2.7/site-packages/cymysql/err.py”, line 138, in _check_mysql_exception
    raise InternalError(errno, errorvalue)
    InternalError: (1130, u”Host ‘xxx.xxx.xxx.xx’ is not allowed to connect to this MySQL server”)
    请问这个怎么解决啊。大佬

    MeowNazo7个月前 (11-21)回复
  4. #15

    请问这里的公用数据库是用的前端的那个数据库吗

    MeowNazo7个月前 (11-21)回复
  5. #14

    libsodium已经更新好久啦,目前1.0.13,可以更新下代码噢

    adg10个月前 (08-30)回复
    • 一键脚本用的是最新的,这个看得人少,所以一直没更新….懒癌晚期

      肥羊10个月前 (08-30)回复
      • 一键后端哪个libsodium 1.013今天挂了测试3遍了。。。 最后用这个手动成功了。。。折腾

        sweet8个月前 (11-09)回复
  6. #13

    We absolutely love your blog and find a lot of your post’s
    to be just what I’m looking for. Do you offer guest writers to write content available for you?
    I wouldn’t mind producing a post or elaborating on a few of the
    subjects you write regarding here. Again, awesome web log!

    Jacquelyn10个月前 (08-30)回复
  7. #12

    Hello it’s me, I am also visiting this website on a regular basis, this site
    is in fact fastidious and the users are genuinely sharing nice thoughts.

    Click Link10个月前 (08-30)回复
  8. #11

    改成数据库上线方式,还是一个鸟样,不过日志不一样了
    [email protected] shadowsocks]# ./logrun.sh
    [[email protected] shadowsocks]# ./tail.sh
    temp_list = str(r[0]).split(‘,’)
    UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 13: ordinal not in range(128)

    2017-08-24 16:19:19 ERROR db_transfer.py:870 Traceback (most recent call last):
    File “/root/shadowsocks/db_transfer.py”, line 863, in thread_db
    rows = db_instance.pull_db_all_user()
    File “/root/shadowsocks/db_transfer.py”, line 390, in pull_db_all_user
    temp_list = str(r[0]).split(‘,’)
    UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 13: ordinal not in range(128)

    2017-08-24 16:20:19 ERROR auto_block.py:293 Traceback (most recent call last):
    File “/root/shadowsocks/auto_block.py”, line 289, in thread_db
    db_instance.auto_block_thread()
    File “/root/shadowsocks/auto_block.py”, line 80, in auto_block_thread
    temp_list = str(r[0]).split(‘,’)
    UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 13: ordinal not in range(128)

    2017-08-24 16:20:20 ERROR db_transfer.py:870 Traceback (most recent call last):
    File “/root/shadowsocks/db_transfer.py”, line 863, in thread_db
    rows = db_instance.pull_db_all_user()
    File “/root/shadowsocks/db_transfer.py”, line 390, in pull_db_all_user
    temp_list = str(r[0]).split(‘,’)
    UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 13: ordinal not in range(128)

    chx81810个月前 (08-25)回复
    • 数据库问题

      肥羊10个月前 (08-25)回复