通往成功之路

全新的shadowsocks网络面板:django-sspane

2018-10-31  本文已影响10人  此十八

昨天晚上登录了一下不常上的Telegram,无意间翻看某群组的时候看到有人截了一张图,图中的内容就是django-sspanel。顿时本屌就来了兴趣,果断去Github上搜了一下,就发现了大佬的这个项目~

这个面板主要吸引我的在于三个点:

1、完全全新的架构,后端采用的django。

2、界面实在是太好看,无论是前端还是后台界面都太美了~

3、作者更新特别勤快,感觉作者是在很认真的维护这个项目,潜力巨大~

今天LALA就来写一篇这个面板的详细安装教程,其实作者自己的wiki中也有安装部署的教程,但是不够全面和详细,实际上如果按照作者的教程去做,会有很多问题=。=

当然LALA之前也写过很多其他SS面板的安装教程,如有其他需要,各位可以参考下面的文章:

<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" src="https://lala.im/88.html/embed#?secret=7luczU0OAV" data-secret="7luczU0OAV" width="500" height="511" title="《详细安装ss-panel-v3魔改版前端+后端教程》—荒岛" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="box-sizing: border-box; max-width: 100%; display: block; margin: 0px auto 16px; width: 500px; height: 511px;"></iframe>

<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" src="https://lala.im/310.html/embed#?secret=dp1eR4v1fu" data-secret="dp1eR4v1fu" width="500" height="306" title="《界面小清新的SS面板:Shadowsocks-Panel安装教程》—荒岛" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="box-sizing: border-box; max-width: 100%; display: block; margin: 0px auto 16px;"></iframe>

还有一些与IDC销售面板的对接教程:

WHMCS整合Shadowsocks实现购买与自动开通

SWAPIDC整合Shadowsocks实现购买与自动开通

那么进入今天的正题,准备一台VPS或者独立服务器,系统选择CentOS7X64。使用Xshell登录你的机器。

安装Git:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">yum -y install git</pre>

安装pyenv:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">git clone https://github.com/pyenv/pyenv.git ~/.pyenv</pre>

设置环境变量:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">echo 'export PYENV_ROOT="HOME/.pyenv"' >> ~/.bash_profile echo 'export PATH="PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile</pre>

增加pyenv init到SHELL:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">echo 'eval "$(pyenv init -)"' >> ~/.bash_profile</pre>

令其生效:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">exec "$SHELL" source ~/.bash_profile</pre>

安装Python所需的相关依赖:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">yum -y install gcc
yum -y install make
yum -y install zlib zlib-devel
yum -y install readline readline-devel readline-static yum -y install openssl openssl-devel openssl-static yum -y install sqlite-devel
yum -y install bzip2-devel bzip2-libs</pre>

安装Python3.6.1:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">pyenv install 3.6.1</pre>

稍等片刻应该就安装好了,此时可以输入如下命令查看相关信息:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">pyenv versions</pre>

回显的内容中有3.6.1等字样则说明安装成功:

image

安装宝塔WEB面板:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">yum install -y wget && wget -O install.sh http://download.bt.cn/install/install.sh && sh install.sh</pre>

安装完成后,新建一个LNMP环境,组件按如图选择:

image

其实django-sspanel实际所需用到的组件只有Nginx和MySQL,PHP其实可选,但是为了往后能对数据库进行更好的管理,安装phpmyadmin还是非常有必要的,所以就一同安装一个PHP吧。

等环境安装好后,点击面板上的网站,新建一个站点:

image

在新窗口中输入你的站点域名以及创建一个FTP账号,这里就不截图了,都是很简单的操作。新建完成后进入到你的站点根目录。

(这一步已经不需要,请看文章下面的更新)打开django-sspanel的Github项目主页,下载源码到本地:https://github.com/Ehco1996/django-sspanel

(这一步已经不需要,请看文章下面的更新)解压压缩包,进行一次不包含文件夹的重压缩,压缩完成后的目录结构应该是这样的:

image

(这一步已经不需要,请看文章下面的更新)将压缩包通过宝塔面板上传到你的站点根目录:

image

(这一步已经不需要,请看文章下面的更新)解压压缩包:

image

回到Xshell中安装virtualenv:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">git clone https://github.com/pyenv/pyenv-virtualenv.git (pyenv root)/plugins/pyenv-virtualenv echo 'eval "(pyenv virtualenv-init -)"' >> ~/.bash_profile exec "$SHELL"</pre>

创建django-sspanel的虚拟运行环境:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">pyenv virtualenv 3.6.1 venv-sspanel</pre>

看到如下图的回显就说明创建成功了:

image

(这一步已经不需要,请看文章下面的更新)切换到项目目录,这里就是你的站点根目录,一般为:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">cd /www/wwwroot/你的站点域名</pre>

这里路径可以在宝塔面板上轻松找到,一定要正确!

将网站根目录的环境设置为virtualenv:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">pyenv local venv-sspanel</pre>

安装程序所需的其他第三方包:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">pip install -r requirements.txt</pre>

看到如下图回显就说明安装完成了:

image

回到宝塔面板中,点击数据库打开phpmyadmin:

image

新建一个数据库,命名为:sspanel。

image

回到宝塔面板中,点击进入你站点根目录中的如图文件夹:

image

编辑simple_setting_product.py文件:

image

填写你的数据库相关信息,以及修改你的站点域名,如图:

image

回到Xshell中,创建数据表:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">python manage.py migrate</pre>

创建完成后应该是如图这样的:

image

测试一下项目是否能正常运行:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">python manage.py runserver</pre>

看到如图回显则说明运行正常:

image

按键盘组合键Ctrl+C结束运行。

创建管理员账号:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">python manage.py createsuperuser</pre>

按如图填写相应信息即可:

image

回到宝塔面板中,点击编辑你站点根目录内的uwsgi.ini文件:

image

修改里面的域名、站点目录路径为你自己的:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[uwsgi] # variables projectname = django-sspanel
projectdomain = '你的站点域名' base = /www/wwwroot/你的站点域名/django-sspanel # config chdir= /www/wwwroot/你的站点域名/django-sspanel/ plungins = python
socket = 127.0.0.1:8080 module = django_sspanel.wsgi:application
pidfile = /tmp/django-sspanel
master = True vacuum = True</pre>

接着点击你的网站设置,找到伪静态这一栏:

image

填写如下规则:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">location /media { alias /www/wwwroot/你的站点域名/django-sspanel/media; # your Django project's media files - amend as required } location /static { alias /www/wwwroot/你的站点域名/django-sspanel/static; #静态文件地址,js/css expires 12h; } location / { include uwsgi_params; uwsgi_pass 127.0.0.1:8080; }</pre>

回到Xshell中运行项目:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">nohup uwsgi uwsgi.ini &</pre>

至此,前端网站就搭建完毕了,不出意外,现在你就可以打开你的站点看到如下界面了:

image

现在来安装后端服务:

切换到root目录下:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">cd /root</pre>

获取源代码:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">git clone https://github.com/Ehco1996/shadowsocksr.git</pre>

进入到ss目录:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">cd shadowsocksr</pre>

安装依赖:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">./setup_cymysql.sh</pre>

初始化配置文件:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">./initcfg.sh</pre>

修改usermysql.json配置文件为你的数据库信息:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">vi usermysql.json</pre>

image

修改user-config.json配置文件,将加密方式和混淆协议什么的都改一下:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">vi user-config.json</pre>

如图:

image

method是加密方式,推荐aes-256-cfb。protocol是协议插件的名称,推荐origin。ofbs是混淆插件名称,推荐plain。

编辑userapiconfig.py确保里面的接口方式是sspanelv2,默认好像就是这个,如果你打开后默认是这个就不用修改了。

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">vi userapiconfig.py</pre>

(vi命令的基本操作方法是,按键盘I进入编辑模式,编辑好后再按一次I退出编辑模式,接着按键盘Esc,再按键盘:号输入小写wq退出并保存)

关闭CentOS7的防火墙:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">systemctl stop firewalld.service</pre>

启动后端程序:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">./run.sh</pre>

现在回到你的站点首页,登录你的管理员账号,点击Django后台选项:

image

点击增加SS账户:

image

绑定你的管理员账号:

image

按如上图中的User选择你的管理员账号名字,端口填写10001。其他信息根据自己的需要修改即可。因为我之前已经绑定好了,所以这里的图片截图是截的修改界面,实际上界面都是差不多的,你输入好这些信息后点击右下角的保存即可。

(这也是安装步骤里面的一部分,只有管理员账号需要做这个设置,普通用户通过前台注册是自动绑定的。但请注意管理员账号一定要自己这样手动绑定一次,不然普通用户注册后都是没绑定的。)

现在回到网站后台中,点击节点列表-添加节点:

image

填写我们之前搭建好的后端节点信息,务必信息要完全一样:

image

在用户中心,我们点击节点信息-节点配置就能够看到详细的SS配置信息了:

image

节点详细信息:

image

将详细信息填写到SS客户端上就能开始爱国了,看个Youtube视频测试下是否能够正常使用:

image

至此,整个的django-sspanel搭建就大功告成啦,晒几张面板截图收尾吧~

后台界面:

image

充值中心:

image

捐赠功能:

image

还有更多功能就不展现了,各位有兴趣的可以自行搭建一番~

最后补充两点:

1、django-sspanel目前还在完善中,可能还会有更多的新功能诞生。

2、目前版本有一个小BUG,就是网站后台的用户列表功能无法正常使用,作者目前还在找原因,不过这个问题不影响使用,即便要管理用户,去更底层的Django也是可以完成的。

image

更新:

由于作者在我发完文章后没多久又更新了版本,故我重新安装了一遍最新版,并且安装方法采用git,测试安装完成后不会再出现之前的用户列表无法使用的问题。

稍微写一下新版本的安装方法。进入到你的站点根目录,路径类似于:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">cd /www/wwwroot/你的站点域名</pre>

下载最新版:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">git clone https://github.com/Ehco1996/django-sspanel.git</pre>

切换到django-sspanel目录:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">cd /django-sspanel</pre>

之后就是接着按照本文上方的安装方法继续安装。

安装完成后还需要在宝塔面板中点击设置,将网站目录改成如图这样:

image

其实也就是在根目录后面再加一个django-sspanel。

另外新版本增加了用户自定义加密方式、混淆等功能,要想正常使用这些功能,需要编辑userapiconfig.py。

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">cd /root
cd shadowsocksr
vi userapiconfig.py</pre>

将接口类型改成legendsockssr,如图:

image

停止运行当前后端:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">./stop.sh</pre>

重新启动后端:

<pre class="prettyprint" style="box-sizing: border-box; overflow: auto; font-family: "courier new"; font-size: 12px; display: block; padding: 10px 15px; margin: 20px 0px; line-height: 20px; color: rgb(248, 248, 212); word-break: break-all; word-wrap: break-word; background: rgb(39, 40, 34); border: none; border-radius: 4px; max-height: 637px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">./run.sh</pre>

用户在前台就可以更改自己想要的加密方式了:

image
上一篇下一篇

猜你喜欢

热点阅读