• nginx-php


    一、环境准备

    yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y
    

    安装字符集转换的库

    tar -zxf libiconv-1.14.tar.gz 
    cd libiconv-1.14
    ./configure --prefix=/usr/local/libiconv
    make && make install
    

    加密的库,并不是必须要装的

    tar -zxf libmcrypt-2.5.8.tar.gz 
    cd libmcrypt-2.5.8
    ./configure 
    make && make install
    sleep 2
    /sbin/ldconfig 
    cd libltdl/
    ./configure --enable-ltdl-install
    make && make install
    

    Mhash是基于离散数学原理的不可逆向的php加密方式扩展库,其在默认情况下不开启。mhash的可以用于创建校验数值,消息摘要,消息认证码,以及无需原文的关键信息保存(如密码)

    tar -zxf mhash-0.9.9.9.tar.gz 
    cd mhash-0.9.9.9
    ./configure 
    make && make install
    echo $?
    
    rm -f /usr/lib64/libmcrypt.*
    rm -f /usr/lib64/libmhash*
    ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la
    ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so
    ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
    ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
    ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a
    ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la
    ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so
    ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2
    ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
    ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
    

      

    tar -zxf mcrypt-2.6.8.tar.gz 
    cd mcrypt-2.6.8
    /sbin/ldconfig 
    ./configure LD_LIBRARY_PATH=/usr/local/lib
    make && make install
    

    二、php安装

    不安装的问题就是可能会报错
     yum install libxslt* -y
    
    tar -zxf php-5.3.27.tar.gz 
    cd php-5.3.27
    

    1)编译安装

    ./configure 
    --prefix=/application/php5.3.27 
    --with-mysql=/application/mysql 
    --with-iconv-dir=/usr/local/libiconv 
    --with-freetype-dir 
    --with-jpeg-dir 
    --with-png-dir 
    --with-zlib 
    --with-libxml-dir=/usr 
    --enable-xml 
    --disable-rpath 
    --enable-safe-mode 
    --enable-bcmath 
    --enable-shmop 
    --enable-sysvsem 
    --enable-inline-optimization 
    --with-curl 
    --with-curlwrappers 
    --enable-mbregex 
    --enable-fpm 					(这个参数很重要,5.3和5.2的不一样,fcgi)
    --enable-mbstring 
    --with-mcrypt 
    --with-gd 
    --enable-gd-native-ttf 
    --with-openssl 
    --with-mhash 
    --enable-pcntl 
    --enable-sockets 
    --with-xmlrpc 
    --enable-zip 
    --enable-soap 
    --enable-short-tags 
    --enable-zend-multibyte 
    --enable-static 
    --with-xsl 
    --with-fpm-user=nginx 
    --with-fpm-group=nginx 
    --enable-ftp
    
    ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
    make && make install
    ln -s /application/php5.3.27/ /application/php
    

    2)nginx的php有两个配置文件,php.ini php-fpm.conf

    拷贝php配置文件
    [root@rsyncclient php-5.3.27]# cp php.ini-production /application/php/lib/php.ini
    

    补充,优化:

    ulimit -n
    http://blog.csdn.net/yangzhenzhen/article/details/8905846

    3)配置php-fpm

    [root@rsyncclient etc]# cp php-fpm.conf.default php-fpm.conf
    [root@rsyncclient lib]# mkdir -p /app/logs/
    [root@rsyncclient etc]# /application/php/sbin/php-fpm -t
    [18-Aug-2017 06:14:26] NOTICE: configuration file /application/php5.3.27/etc/php-fpm.conf test is successful
    [root@rsyncclient etc]# /application/php/sbin/php-fpm
    [root@rsyncclient etc]# netstat -tnlp | grep php-fpm
    tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      36309/php-fpm     
    

    4)配置开机启动

    可以配置它的开机启动
    cat >>/etc/rc.local <<EOF
    /etc/init.d/mysqld start
    /application/php/sbin/php-fpm
    /application/nginx/sbin/nginx
    EOF
    

    补充
    [root@rsyncclient extra]# sed -e '6,12s/#//g' bbs.conf
    [root@rsyncclient extra]# sed -i '6,12s/#//g' bbs.conf

    三、nginx与php关联

    一个web站点的配置

    [root@rsyncclient extra]# vim bbs.conf 
    server {
            listen       80;
            server_name  bbs.etiantian.org;
                root   html/bbs;
                index  index.php  index.html index.htm;
             location ~.*.(php|php5)?$ {
                # root           html/bbs;
                 fastcgi_pass   127.0.0.1:9000;
                 fastcgi_index  index.php;
                # fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
                 include        fastcgi.conf;
             }
        }
    

    主配置

    worker_processes  1;
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        error_log logs/error.log error;
     
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
     
        include extra/cms.conf;
        include extra/bbs.conf;
        #include extra/wiki.conf;
    }
    

    此时也可以用我前面的方式,lamp的方式检测nginx与php,php与数据库的联系。

  • 相关阅读:
    leetcode Convert Sorted List to Binary Search Tree
    leetcode Convert Sorted Array to Binary Search Tree
    leetcode Binary Tree Level Order Traversal II
    leetcode Construct Binary Tree from Preorder and Inorder Traversal
    leetcode[105] Construct Binary Tree from Inorder and Postorder Traversal
    证明中序遍历O(n)
    leetcode Maximum Depth of Binary Tree
    限制 button 在 3 秒内不可重复点击
    HTML 和 CSS 画三角形和画多边行基本原理及实践
    在线前端 JS 或 HTML 或 CSS 编写 Demo 处 JSbin 与 jsFiddle 比较
  • 原文地址:https://www.cnblogs.com/bill2014/p/7476984.html
Copyright © 2020-2023  润新知