Total Pageviews

Sunday, 7 February 2016

shadowsocks的php版:shadowsocks-php

A php port of shadowsocks based on Workerman

配置:
Applications/Shadowsocks/config.php
运行:
php start.php start -d
停止:
php start.php stop
查看状态:
php start.php status

说明:
本应用基于workerman框架开发,workerman更多信息参见 http://www.workerman.net ,
http://www.workerman.net/download/workerman,
https://github.com/walkor/workerman

from https://github.com/walkor/shadowsocks-php
-----------
我的补充-shadowsocks-php的搭建

首先在你的vps上安装php环境:
apt-get install php5 php5-gd php5-mysql php5-mcrypt php5-cli (for debian/ubuntu,这里把php5-mysql 包括进去是为了方便以后装mysql)

yum install php php-gd php-mysql php-mcrypt php-cli (for centos/fedora,这里把php-mysql 包括进去是为了方便以后装mysql)

然后安装composer:
curl http://getcomposer.org/installer | php (此命令会下载composer.phar到当前目录下)
显示:
...
Downloading...
Composer successfully installed to: /root/composer.phar
Use it: php composer.phar

mv composer.phar /usr/local/bin/
这样, composer就装好了。

然后, 
sudo composer.phar require workerman/workerman
显示如下:
root@AR:~# sudo composer.phar require workerman/workerman
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
Using version ^3.3 for workerman/workerman
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing workerman/workerman (v3.2.8)
  - Installing workerman/workerman (v3.3.1)
    Downloading: 100%        

Writing lock file
Generating autoload files
root@AR:~#

这样,workerman就装好了。

然后,
git clone https://github.com/walkor/shadowsocks-php
cd shadowsocks-php
root@AR:~/shadowsocks-php# ls
Applications README.md start.php  
MIT-LICENSE.txt  Workerman

root@AR:~/shadowsocks-php# nano Applications/Shadowsocks/config.php
root@AR:~/shadowsocks-php# cat Applications/Shadowsocks/config.php
<?php 
// 服务器地址
$SERVER = '你的vps的ip';
// 加密算法
$METHOD = 'aes-256-cfb';
// 密码
$PASSWORD = '你设置的密码';
// 服务器端口
$PORT = 你指定的服务器端口号;
// 客户端端口
$LOCAL_PORT = 1080;
// 启动多少进程
$PROCESS_COUNT = 10;
root@AR:~/shadowsocks-php# php start.php start -d (此为启动shadowsocks-php的命令,需按enter键2次)

停止shadowsocks-php的命令为:
php start.php stop

至于客户端,通用各平台下的shadowsocks客户端。

可能是设置了10个进程的缘故,用shadowsocks-php翻墙的速度挺快的。