centos6搭建在线web代理

最近有个需求需要搭建一个在线web代理,懒得自己写就找到两个php程序:

  1. knProxy:https://github.com/jabbany/knProxy
  2. glype:https://www.glype.com/download.php

从部署角度来讲这两个都很简单,功能上也很类似,这里我就以第二个为例吧,使用nginx来部署。先来安装nginx和php-fpm

yum install nginx
yum install php-fpm</pre>

下载glype后解压到/var/www/html/glype目录,并在/etc/nginx/conf.d/中创建配置文件如下:

server {
        listen  8000;
        server_name     192.168.2.46;
        access_log      /var/log/nginx-proxy-access.log;
        error_log       /var/log/nginx-proxy-error.log;
        charset         utf-8;
        default_type    text/html;
        root /var/www/html/glype;
        location / {
            index index.php;
        }
        location ~* \.php$ {
            fastcgi_index   index.php;
            fastcgi_pass    127.0.0.1:9000;
            fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
            include         fastcgi_params;
        }
}

当然了,防火墙什么的根据具体情况开放。之后启动php-fpm以及nginx

service php-fpm start
service nginx start

这样一个简单地web在线代理就完成了,如果服务器在国外,你懂得。