通往成功之路

最完整的ss-panel前后端搭建方法(最新版)

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

ss-panel(V2)版是一种傻瓜式的搭建方法,直接是上LNMP环境然后访问就行了,但是第三版的逼格有点高了,但是代码更加清晰,性能更好了,本站的免费ss帐号分享平台就是基于ss-panel!好了,下面介绍下搭建的方法!

如果你的Linux基础不好的话,可以直接看!**ss-panel(ss-manyuser)前后端一键安装脚本 **这个一键脚本,如果你的基础可以的话,可以继续往下看。。。。

首先搭建前端

这个就没什么好说的,直接可以使用LNMP一键搭建环境!

具体见:lnmp一键搭建

本教程所使用的环境是 NGINX + PHP 7 + MariaDB 10。当然其他主流 LNMP/LAMP 架构都可以(PHP >= 5.4),确保你的站点可以访问后就继续吧。

服务器需要安装git(yum -y install git)

下载 ss-panel 源码

ss-panel GitHub 项目地址:orvice/ss-panel

cd 至你的站点 web 根目录,从 git 上 clone 源码:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 23px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

|

git clone https://github.com/orvice/ss-panel.git

|

以上可以更新到最新版,如果需要版本和教程一致,请使用一下的命令

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 23px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

|

git clone https://github.com/david7207/panel.git

|

当然你也可以下载源码再用 WINSCP 传到 VPS 上

注意 git clone 后的目录结构,请务必保证 index.php 在站点根目录下。

配置 ss-panel

源码下载下来后

你需要在你站点的 NGINX 设置中加入这些(Apache自行添加):

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 83px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

3

4

5

|

root /home/wwwroot/ss-panel/public; //定位到网站的根目录

location / {

try_files  $uri  $uri/  /index.php$is_args$args;    //url重写

}

|

V3 版的 ss-panel 使用了 composer 来自动管理依赖,这样就不用把一堆库打包在一起

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 38px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

|

curl -sS https://getcomposer.org/installer | php

php composer.phar install

|

这样,composer 就会根据 composer.json 中的内容自动安装好依赖,vendor 文件夹也出现了。

接着进行配置:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 23px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

|

cp .env.example .env

|

将 .env.example 复制一份重命名为 .env,自行修改其中的数据库和站点信息:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 1193px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

|

// ss-panel v3 配置

//

// !!! 修改此key为随机字符串确保网站安全 !!!

key = 'randomKey'

env = 'prod' // 正式环境请保持env为prod确保安全

debug = 'false' // 正式环境请确保为false

appName = 'ss-panel3' //站点名称

baseUrl = 'https://www.google.com' // 站点地址

timeZone = 'PRC' // RPC 天朝时间 UTC 格林时间

pwdMethod = 'md5' // 密码加密 可选 md5,sha256

salt = '' // 密码加密用,从旧版升级请留空

theme = 'default' // 主题

session = 'file' //默认

cache = 'file' //默认

tokenDriver = 'db' //默认

// mu key 用于校验ss-go mu的请求

muKey = ''

// 邮件

mailDriver = 'mailgun' // mailgun #smtp不在支持,仅供测试

// 注册限制,每天每个ip能注册的次数

ipDayLimit = '10'

// 邮箱验证设置

emailVerifyEnabled = 'false' // 是否开启注册时邮箱验证 (true:开启 false:关闭)

emailVerifyCodeLength = '8' // 邮箱验证代码长度

emailVerifyTTL = '30' // 验证代码有效时间 单位分钟

// 用户签到设置

checkinTime = '22' // 签到间隔时间 单位小时

checkinMin = '93' // 签到最少流量 单位MB

checkinMax = '97' // 签到最多流量

//

defaultTraffic = '5' // 用户初始流量 单位GB

// 注册后获得的邀请码数量

inviteNum = '5'

// 记录流量日志到dynamodb ,beta,请勿开启

log_traffic_dynamodb = 'false'

database 数据库配置

db_driver = 'mysql'

db_host = 'localhost'

db_port = '3306'

db_database = 'sspanel'

db_username = 'sspanel'

db_password = 'sspanel'

db_charset = 'utf8'

db_collation = 'utf8_general_ci'

db_prefix = ''

redis

redis_scheme = 'tcp'

redis_host = '127.0.0.1'

redis_port = '6379'

redis_database = '0'

redis_pass = ''

mailgun

mailgun_key = ''

mailgun_domain = ''

mailgun_sender = ''

smtp

smtp_host = ''

smtp_username = ''

smtp_port = ''

smtp_name = ''

smtp_sender = ''

smtp_passsword = ''

smtp_ssl = 'true'

aws

aws_access_key_id = ''

aws_secret_access_key = ''

aws_region = 'ap-northeast-1'

aws_ses_region = 'us-east-1'

aws_ses_sender = ''

|

数据库的创建就不多说了,建站的一般都玩过数据库吧?将根目录下的 db.sql 导入到数据库中即可。其他配置自行修改。

最完整的ss-panel前后端搭建方法(最新版)

最后一步就是设置目录权限

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 38px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

|

chown -R nginx:nginx ss目录

chmod -R 777 storage

|

现在就可以访问你的站点了,是不是熟悉的界面?

添加管理员

新版的ss-panel,可以直接cd到你的网站目录,执行

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 23px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

|

php xcat createAdmin

|

添加管理员

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 98px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

3

4

5

6

|

add admin/创建管理员帐号.....

Enter your email/输入管理员邮箱: xxx@xxx.com

Enter password for: h@prinzeugen.net /为xxx@xxx.com 添加密码 xxx

Email: xxx@xxx.com, Password: xxx

Press [Y] to create admin..... 按下[Y]确认来确认创建管理员账户..... y

start create admin accountSuccessful/ 添加成功!

|

到这里,前端就已经配置完成了!

部署配置 ss-R

为了保证教程的可靠性,克隆自己的项目吧

先 clone 到本地:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 23px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

|

git clone https://github.com/david7207/shadowsocks-R.git

|

然后安装必要组建

centos:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 38px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

|

yum install python-setuptools && easy_install pip

yum install m2crypto git

|

ubuntu/debian:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 38px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

|

apt-get install python-pip

apt-get install m2crypto git

|

配置 ss-R

进入根目录初始化配置(假设根目录在~/shadowsocks,如果不是,命令需要适当调整):

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 53px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

3

|

cd ~/shadowsocks

bash initcfg.sh

|

shadowsocks目录内,对userapiconfig.py里以下内容进行相应修改:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 38px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

|

API_INTERFACE = 'sspanelv2' //修改接口类型

|

根据你的数据库类型,需正确选择使用sspanelv2, sspanelv3, sspanelv3ssr之一

然后修改usermysql.json里面的内容:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 218px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

3

4

5

6

7

8

9

10

11

12

13

14

|

{

"host":  "127.0.0.1",

"port":  3306,

"user":  "ss",

"password":  "pass",

"db":  "shadowsocks",

"node_id":  1, //panel先添加节点,然后确定后再管理面板就看到节点ID

"transfer_mul":  1.0, //以下可以忽略

"ssl_enable":  0,

"ssl_ca":  "",

"ssl_cert":  "",

"ssl_key":  ""

}

|

以上包括(按次序):数据库服务器地址,端口,数据库登陆用户名,密码,数据库,节点ID(sspanelv3支持),等等,

要注意sspanelv3必须正确填写node_id才能正常使用,并且在填写该ID前,必须在面板上已经添加好该节点,以确定节点ID后,再在此处填写。

然后编辑user-config.json:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 53px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

3

|

"method":"aes-256-cfb", //修改成您要的加密方式的名称

"protocol": "auth_sha1_compatible", //修改成您要的协议插件名称

"obfs": "tls1.0_session_auth_compatible", //修改成您要的混淆插件名称

|

如果需要chacha20加密

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 98px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

2

3

4

5

6

|

yum -y groupinstall "Development Tools"

wget https://github.com/jedisct1/libsodium/releases/download/1.0.10/libsodium-1.0.10.tar.gz

tar xf libsodium-1.0.10.tar.gz && cd libsodium-1.0.10

./configure && make -j2 && make install

echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf

ldconfig

|

如果需要开机自启动,直接把代码写在rc.local!

后台运行并启用日志:

<textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly="" style="box-sizing: border-box; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 12px !important; font-family: Monaco, MonacoRegular, "Courier New", monospace !important; color: rgb(0, 0, 0); line-height: 15px !important; background: rgb(255, 255, 255); width: 744.469px; overflow: hidden; padding: 0px 5px; margin: 0px; height: 23px; position: absolute; opacity: 0; border: 0px; border-radius: 0px; box-shadow: none; white-space: pre; word-wrap: normal; resize: none; tab-size: 4; z-index: 0;"></textarea>

|

1

|

nohup python server.py > /var/log/shadowsocks.log 2>&1 &

|

OK,大功告成!现在就可以在后台添加节点了,试试吧!ss-panel的好处就是大家共享ss节点:

例如本站的 七月上

就是基于的ss-panel!如果需要更多,更稳定的节点,直接点击https://www.7yueshang.com 加入我们吧,免费的喔!

对于ss-panel的搭建如果还有什么问题,可以留言,我会尽快回复的!

上一篇下一篇

猜你喜欢

热点阅读