nginx+php5.6.12+discuz

Posted on 2016-03-02 17:41  心在北方  阅读(841)  评论(0编辑  收藏  举报

 

#/usr/local/nginx/sbin/nginx  -V
nginx version: nginx/1.8.0
built by gcc 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) 
configure arguments: --with-openssl=../openssl-1.0.1m
 
php:
# php -v
PHP 5.6.16 (cli) (built: Nov 26 2015 07:52:51) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans
备注:实际是php 5.6.12  原来用yum 安装过 5.6.16
 
主要是php的安装
配置环境:
./configure  --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --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 --with-gettext --disable-fileinfo --enable-opcache
 
安装的过程报的错:
<1> configure:error: xml2-config not found.Please check you libxml2 installation
 
解决:  yum install  libxml2  libxml2-devel
 
<2> configure:error: please reinstall the libcurl distribution easy.h ....
 
解决:yum install libcurl  curl-devel
 
<3> configure:error: jepglib.h not found
 
解决: yum install libjpeg libjpeg-devel
 
<4> error:png.h not found
 
解决: yum install libpng libpng-devel
 
<5> freetype-config not found
 
解决:yum install freetype-devel
 
<6> mcrypt.h not found please reinstall limcrypt 
 
解决:yum 安装limcrypt 会失败  下载 libmcrypt-2.5.7.tar.gz 编译安装
 
<7> error:Don't konw how to define struct flock on this system  set --enable-opcache=no
 
解决:编辑 /etc/ld.so.conf   (库文件)  加入 /usr/local/lib   再执行  ldconfig -v   
注: 网上有说法是 64位操作系统 用 /usr/local/lib64 结果试了不行
 
configure 好了之后
make  
make install
 
二、
# pwd
/root/soft/php-5.6.12
# cp php.ini-production /usr/local/php/etc/php.ini
 
#pwd
/root/soft/php-5.6.12/sapi
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
 
三、
echo "PATH=$PATH:/usr/local/php/bin:/usr/local/php/sbin" >> /etc/profile
source !$  # 刷新系统环境
 
四、
[root@test fpm]# cp php-fpm.conf /usr/local/php/etc/php-fpm.conf
[root@test fpm]# pwd
/root/soft/php-5.6.12/sapi/fpm
 
五、
[root@test fpm]# /usr/local/php/sbin/php-fpm -t
[01-Mar-2016 17:19:47] NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful
 
六、
 
[root@root fpm]# service php-fpm start
Starting php-fpm [01-Mar-2016 17:20:33] ERROR: [pool www] cannot get uid for user 'www'
[01-Mar-2016 17:20:33] ERROR: FPM initialization failed
 failed
 
解决:useradd www
 
七、
配置 nginx
这里走了不少弯路
 
server {
        listen 3335;
        server_name localhost;
        index index.html index.htm index.php;
        root /var/www;
 
        location ~ \.php$ {
 
           fastcgi_pass     127.0.0.1:9000;
           fastcgi_index     index.php;
           fastcgi_param     SCRIPT_FILENAME /var/www$fastcgi_script_name;
           include                 fastcgi_params;
        }
    }
八、
二级域名配置:
 
server {
        listen 80;
        server_name bbs.xxx.com;
        index index.html index.htm index.php;
        root /var/www/html;
 
        location ~ \.php$ {
 
           fastcgi_pass     127.0.0.1:9000;
           fastcgi_index     index.php;
           fastcgi_param     SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
           include                 fastcgi_params;
        }
    }
server {
        listen 80;
        server_name bbs.yyyy.com;
        index index.html index.htm index.php;
        root /var/www/html;
 
        location ~ \.php$ {
 
           fastcgi_pass     127.0.0.1:9000;
           fastcgi_index     index.php;
           fastcgi_param     SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
           include                 fastcgi_params;
        }
    }

 

Copyright © 2024 心在北方
Powered by .NET 9.0 on Kubernetes