• linux服务器WEB环境一键安装包lanmp教程之五


    在我们安装了linux服务器WEB环境一键安装包lanmp后,可能会有不少疑问还有就是使用过程中出现的问题,下面为大家总结几点比较常见的,如若还有其他疑问,可到wdlinux论坛寻找相关教程。

    1、增加apache支持CGI程序

    apache默认已支持CGI,但默认没有开启,如需要CGI支持,可用如下方法
    1
    vi /www/wdlinux/apache/conf/httpd-wdl.conf
    在最后增加
    AddHandler cgi-script .cgi .pl

    echo "AddHandler cgi-script .cgi .pl" >>/www/wdlinux/apache/conf/httpd-wdl.conf

    2
    修改虚拟主机配置文件/www/wdlinux/apache/conf/vhost/wdlinux.cn.conf,如下位置
    <Directory /www/web/wdlinux.cn/public_html>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    修改替换为
    <Directory /www/web/wdlinux.cn/public_html>
        Options FollowSymLinks ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    实际上就是增加了 "ExecCGI"

    重起apache
    service httpd restart

    现在可以测试一下
    vi /www/web/wdlinux.cn/public_html/test.cgi
    #!/usr/bin/perl
    print "Content-type: text/html ";
    foreach $var (sort(keys(%ENV))) {
        $val = $ENV{$var};
        $val =~ s| |\n|g;
        $val =~ s|"|\"|g;
        print "${var}="${val}" ";
    }
    保存

    还需要付以此文件有执行权,如
    chmod 755 /www/web/wdlinux.cn/public_html/test.cgi

    2、解决nginx 502 bad gateway问题

    最近在把joomla 1.5.18的一个站点从虚拟主机的apache移到另一台VPS主机的nginx上,根据joomla官方提供的nginx rewrite规则修改了nginx的配置,结果的大部分的网页都正常显示,只有一个contact us的页面在发送邮件的时候,遇到错误:nginx 502 badgateway

    系统环境:
    CentOS6.4 86x64
    wdcp: wgethttp://dl.wdlinux.cn:5180/lanmp_laster.tar.gz
    0c5d80fd4b28b7049d18275962f1fc09  lanmp_laster.tar.gz
    nginx1.0.15
    mysql5.1.63
    php5.2.17

    有2条错误比较引人注意:
    tail/www/wdlinux/nginx_php-5.2.17/logs/php-fpm.log
    [WARNING] fpm_children_bury(), line 215: child 16523(pool default) exited on signal 15 SIGTERM after 1868.423609 seconds from start
    tail /www/wdlinux/nginx/logs/error.log

    [error] 16501#0: *5 recv() failed (104: Connectionreset by peer) while reading response header from upstream, client:123.456.789, server: www.shop-yishunbike.com, request: "POST/index.php?option=com_contact&view=contact&id=1&Itemid=210HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host:"............", referrer: "........................."

    用site:()搜索:

    site:(wdlinux.cn)recv() failed (104: Connection reset by peer)

    谷歌百度对以上错误的搜索结果都是要修改php.ini,php-fpm.conf,nginx.conf等配置,结果都没成功
    回过头来好好思考这2个错误提示,nginx的错误应该是由于nginx提交给php-fpm(127.0.0.1:9000)的请求没有得到正确的回复引起的,所以可能是php-fpm的问题。
    所以想到重新编译fpm-php,结果成功了

    重新编译过程:
    参考wdcp中lanmp.sh脚本的安装路径:
    ./configure --prefix=$IN_DIR/$PHP_DIR--with-config-file-path=$IN_DIR/$PHP_DIR/etc --with-mysql=$IN_DIR/mysql--with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir--with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath--enable-discard-path --enable-inline-optimization --with-curl --enable-mbregex--enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf--with-openssl --with-mhash --enable-ftp --enable-sockets --enable-zip $NV


    再参考张宴大哥的那篇nginx文章,运行如下命令:
    tarzxf php-5.4.13.tar.gz
    cdphp-5.4.13
    LIBS="-lm-ltermcap-lresolv"DYLD_LIBRARY_PATH="/www/wdlinux/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
    LD_LIBRARY_PATH="/www/wdlinux/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"

    #./configure阶段,在后面加上-n选项不生成配置,仅测试是否能通过,通过的话去掉-n,再运行一次


    ./configure--prefix=/www/wdlinux/php2--with-config-file-path=/www/wdlinux/php2/etc--with-mysql=/www/wdlinux/mysql --with-mysqli=/www/wdlinux/mysql/bin/mysql_config--with-mcrypt=/usr --with-iconv-dir=/usr --with-libxml-dir=/usr--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-xml--disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem--enable-inline-optimization --with-curl --enable-mbregex --enable-fpm--enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash--enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap -n
    makeZEND_EXTRA_LIBS='-liconv'
    makeinstall

    关闭原来的php-fpm
    /etc/init.d/php-fpmstop

    打开新的php-fpm进程
    /www/wdlinux/php2/sbin/php-fpm

    打开contact us页面,发送邮件,成功发送

    3、lanmp一键包,wdcp后台等故障排查法

    虽然我测试的没问题,但总还是有一些问题,也许是跟环境有关,又或许是跟操作有关。
    请大家切记,务必按说明操作

    首先用
    netstat -lnpt
    检查有哪些端口

    如果后台打不开,从上面里看有没有8080端口
    A 如果有,可能是防火墙的原因,iptables -L -n查看,或iptables -F清楚再打开
    B 如果没有,可能是没启动或是没安装成功,可以启动看看,如service wdapache start

    80,88,21都按如上所述的方法检查
    相关的目录,启动,说明请看
    http://www.wdlinux.cn/bbs/thread-192-1-1.html

    本文摘自wdlinux论坛http://www.wdlinux.cn/bbs/,欢迎转载~

  • 相关阅读:
    sed 使用总结
    rgmanager 介绍
    linux nbd & qemu-nbd
    corosync基本使用
    svn 基本使用
    tornado 实践
    mysql mac启动
    postgresql
    django
    django
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3283607.html
Copyright © 2020-2023  润新知