SS配置笔记

2016年6月5日 0 条评论

经常需要用到SS,为了方便管理,特使用了ss-panel,可以直接在后台新增删除用户,查看及新增流量。

需要安装2个东西,一个是面板前端,另外一个则是后端程序。另外,为了让程序持续运行,还需要配置守护进程;为了配置多节点,需要设置允许数据库远程访问。

一、前端:

cd /usr/html/domains/xiaoq.in/

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

mv ss-panel ss

chown -R www-data:www-data /usr/html/domains/

配置nginx 配置文件:

server {
listen 80;
server_name ss.xiaoq.in;
root /usr/html/domains/xiaoq.in/ss/public;

index index.html index.htm index.php;
access_log /var/log/nginx/ss.xiaoq.in.access.log;
error_log /var/log/nginx/ss.xiaoq.in.error.log;

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location = /apple-touch-icon.png { access_log off; log_not_found off; }
location = /apple-touch-icon-precomposed.png { access_log off; log_not_found off; }
location ~ /\. { deny all; access_log off; log_not_found off; }

location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}

service nginx restart

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

sudo apt-get install redis-server

cp .env.example .env

nano .env

# database 数据库配置
db_driver = ‘mysql’
db_host = ‘localhost’
db_database = ‘ss-panel’
db_username = ‘test’
db_password = ‘password’
db_charset = ‘utf8’
db_collation = ‘utf8_general_ci’
db_prefix = ”

新增管理员账号:

php xcat createAdmin

二、后端:

cd

git clone -b manyuser https://github.com/mengskysama/shadowsocks-rm.git

cd shadowsocks-rm/shadowsocks

sudo apt-get install python-pip

pip install cymysql

nano config.py

MYSQL_HOST = ‘localhost’
MYSQL_PORT = 3306
MYSQL_USER = ‘test’
MYSQL_PASS = ‘password’
MYSQL_DB = ‘ss-panel’

python servers.py

三、配置守护进程:

pip install supervisor

echo_supervisord_conf > /etc/supervisord.conf

supervisord

nano /etc/supervisord.conf

[program:ss-manyuser]
command = python /root/shadowsocks-rm/shadowsocks/servers.py
user = root
autostart = true
autorestart = true

killall -HUP supervisord

supervisorctl restart ss-manyuser

四、配置多节点:

所谓多节点,即在每个节点服务器上安装服务端,然后其中的数据库连接到前端的数据库上,前端数据库需要开放权限,允许其他节点可以访问到,需要把mysql 的bind ip修改为0.0.0.0,以及MySQL的用户权限中的host名修改为%。

五、广告:

提供SS付费账号,欢迎在线购买:http://ss.xiaoq.in/,月付10元起!

免费试用邀请码:

### 邀请码(点右键复制链接) 状态
1 FVhLESAjBTX27M42mMLVTPUsMPO6bRGa 可用
2 tQtOg6QhJkZsMb9LwALhQXlWAbTAvqYI 可用
3 Zwb6OH1eqJshZjyRzKw2EHIqyhBipsWg 可用
4 AghRji0cFycsmDG9JeyDYyOD1cFJW0TY 可用
5 AdCWMRLUjqvG9N7zqW3t1Xxk0FqG7bFK 可用

上一篇: | 下一篇:

Comments

  1. 还没有任何评论,你来说两句吧

发表评论

  • 发表评论