• Nginx配置


    环境问题
    Linux(centos6.6):
         Linux xiao-wei 2.6.32-504.16.2.el6.x86_64 #1 SMP Wed Apr 22 06:48:29 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    Nginx:
         nginx version: nginx/1.8.0
    Mysql:
         mysql  Ver 14.14 Distrib 5.6.24, for Linux (x86_64) using  EditLine wrapper
    php:
         PHP 5.6.8 (cli) (built: Apr 30 2015 00:05:13) 
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies


    注:安装过程參考下面文章

    一、安装准备:
    yum -y install gcc automake autoconf libtool make

    yum -y install gcc gcc-c++ glibc

    yum -y install libmcrypt-devel mhash-devel libxslt-devel
    libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel
    zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel
    ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel
    krb5 krb5-devel libidn libidn-devel openssl openssl-devel

    *此时会发现libmcrypt-devel mhash-devel没有安装(源没有发现该安装包!!_!!)
    採用源代码安装*(參考文章  http://www.cnblogs.com/huangzhen/archive/2012/09/12/2681861.html )

    源代码编译安装,去http://www.sourceforge.net下载Libmcrypt,mhash,mcrypt安装包 
    libmcrypt(libmcrypt-2.5.8.tar.gz );mcrypt(mcrypt-2.6.8.tar.gz ); mhash(mhash-0.9.9.9.tar.gz )

    2 .先安装Libmcrypt
    #tar -zxvf libmcrypt-2.5.8.tar.gz
    #cd libmcrypt-2.5.8
    #./configure
    #make
    #make install 说明:libmcript默认安装在/usr/local 

    3.安装mhash
    #tar -zxvf mhash-0.9.9.9.tar.gz
    #cd mhash-0.9.9.9
    #./configure
    #make
    #make install

    4.安装mcrypt
    #tar -zxvf mcrypt-2.6.8.tar.gz
    #cd mcrypt-2.6.8
    #LD_LIBRARY_PATH=/usr/local/lib ./configure
    #make
    #make install

    二、php-fpm安装

    wget http://cn2.php.net/distributions/ (注:这里须要找对应server下载对应版本号)
    tar zvxf php-5.6.24.tar.gz
    cd php-5.6.24
    ./configure --prefix=/usr/local/php  --enable-fpm --with-mcrypt
    --enable-mbstring --disable-pdo --with-curl --disable-debug  --disable-rpath
    --enable-inline-optimization --with-bz2  --with-zlib --enable-sockets
    --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex
    --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli
    --with-gd --with-jpeg-dir

    *出现checking for known struct flock definition... configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no错误*
    解决方法:(參考 http://blog.linuxeye.com/342.html )

    configure前执行export LD_LIBRARY_PATH=/lib/:/usr/lib/:/usr/local/lib

    make all install

    以上就完毕了php-fpm的安装。


    以下是对php-fpm执行用户进行设置
    #cd /usr/local/php
    #cp etc/php-fpm.conf.default etc/php-fpm.conf
    #vi etc/php-fpm.conf
    改动
    user = www-data
    group = www-data

    假设www-data用户不存在,那么先加入www-data用户
    #groupadd www-data
    #useradd -g www-data www-data

    三、编译安装nginx
    然后依照http://www.nginx.cn/install 安装nginx

    改动nginx.conf文件
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ .php$ {
    root html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }

    四、创建php文件

    在/usr/local/nginx/html下创建index.php文件,输入例如以下内容

    <?php
        echo phpinfo();
    ?

    >



    五、启动服务

    启动php-fpm和nginx

    /usr/local/php/sbin/php-fpm 
    #手动打补丁的启动方式/usr/local/php/sbin/php-fpm start

    sudo /usr/local/nginx/nginx


    六、測试
  • 相关阅读:
    成功的速度一定要大于父母老去的速度
    luogg_java学习_09_泛型_集合
    luogg_java学习_08_设计模式_API
    luogg_java学习_07_抽象类_接口_多态学习总结
    报表请求默认输出格式(html或者excel)设置
    XML报表开发基本过程
    rtf模板常用技巧
    xml模板提交请求submit_request
    XML基础知识
    HTML语言常用语法
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/5147845.html
Copyright © 2020-2023  润新知