月度归档: 2013 年 8 月

  • 4步完成,vps搭建VPN

    4步完成,vps搭建VPN

    //2013-11-12更新—————
    发现了一揽子打包安装VPN的方法。
    采用AMH面板,众多功能包采用模块式插件安装。
    众多模块中包括了PPTP-VPN-1.1 模块(一键安装PPTP-VPN服务);
    甚至都不用通过终端命令行添加账户。而直接安装LanYing-VPN-1.0模块(VPN代理服务器对用户的管理,支持PPTP和L2TP方式的VPN代理用户管理)可视化操作添加账户。
    对于服务器只用来架设VPN的,可以考虑这种形式安装。简单快捷。
    AMH还有SSL的模块,采用SSL的方式也可以破墙。

    //自架VPN,4步安装步骤—————–

    自架VPN虽然速度不俗,在20M使用带宽下,最高1080p在线视频流量能跑到527kb每秒。
    但是在低带宽环境下,表现依旧不如wallproxy的多线程下载。
    优势在于,VPN表现平稳,完全模拟服务器所在的上网环境,
    由于GAE被大量使用,使用GAE的代理现在越来越多的被各个网站所限制。(维基百科的编辑,youtube的部分视频。)

    VPS配置:洛杉矶 OpenVZ VPS 512MB 100M共享带宽
    系统环境: CentOS5.4 无web环境

    也试了一个 Xen VPS – 64MB 的,效果也不差,
    只是64M内存看着实在揪心,除了vpn其它估计什么也做不了。

     

    以下,VPN的搭建记录:

    1–确保服务器配置天生支持pptp的VPN(很多VPS后台具有TUN和ppp的开关)。
    cat /dev/net/tun
    //cat: /dev/net/tun: File descriptor in bad state
    //返回上面这句“File descriptor in bad state”则确定可以安装,继续下面步骤。

     

    2–进入安装步骤;
    //安装环境软件依赖:
    yum makecache
    yum -y update
    yum -y install ppp wget iptables iptables-devel perl

     

    3–使用googlecode的pptp资源,安装pptp。
    //32位安装:
    rpm -ivh http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.i386.rpm
    //64位安装:
    rpm -ivh http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.x86_64.rpm

     

    4–配置参数:
    vim /etc/pptpd.conf
    //去掉以下两句的注释:
    localip 192.168.0.1
    remoteip 192.168.0.234-238,192.168.0.245
    vim /etc/ppp/options.pptpd
    //去掉ms-dns的注释,并修改为8.8.8.8和8.8.4.4:
    ms-dns 8.8.8.8
    ms-dns 8.8.4.4

    vim /etc/sysctl.conf
    //修改net.ipv4.ip_forward=0,改为1,
    //并注释net.ipv4.tcp_syncookies = 1
    net.ipv4.ip_forward=1
    # net.ipv4.tcp_syncookies = 1
    //保存后执行下面一句
    sysctl -p

    //添加VPN账号和配置密码。
    vim /etc/ppp/chap-secrets
    zhanghao pptpd mima *
    //如上格式,zhanghao代表用户名,mima为密码,
    //可多行建立多个VPN帐号

    //添加iptables规则。OpenVZ虚拟环境执行:(xxxx为VPS的IP地址)
    iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source X.X.X.X
    //Xen的虚拟环境执行:
    iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE

    //最后各种重启,启动,以及设置开机启动。
    /etc/init.d/iptables save
    /etc/init.d/iptables restart
    /etc/init.d/pptpd restart
    chkconfig pptpd on
    chkconfig iptables on

    搞定。
    pc,mac ,手机,所有平台无需任何客户端和配置,就可以链接了
    vpn

    vpn-vps

  • 设置MySQL远程链接


    //更改mysql自身数据库‘mysql’
    use mysql;
    select host,user,password from user;

    //%允许任何主机连接本数据库,
    grant all privileges on *.* to 'root'@'%' identified by 'XXXXXXXXX' with grant option;

    //重置mysql服务;
    flush privileges;

    //退出mysql
    exit;

    //如果有防火墙,确保打开3306端口
    iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

    //开关防火墙(重启)
    chkconfig iptables on
    chkconfig iptables off

    //临时开关防火墙
    service iptables start
    service iptables stop

    //连接方命令:
    mysql -u root -p -h 地址

  • Lnmp—php5.5编译安装

    Lnmp—php5.5编译安装

    安装版本:php5.5

    nginx:1.5.3

    PHP:5.5.1

    CentOS 5.4 32位   php-fpm编译配置参数:

    ./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-mysql=/usr/ –with-iconv-dir –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-discard-path –enable-magic-quotes –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex –enable-fastcgi –enable-fpm –enable-force-cgi-redirect –enable-mbstring –with-mcrypt –enable-ftp –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –with-mime-magic

    报错一个:
    configure: error: Please reinstall the libcurl distribution – easy.h should be in <curl-dir>/include/curl/

    解决方法: yum -y install curl-devel

    QQ20130804-3