您的位置:首页 > 运维架构 > Nginx

nginx+php5.6.12+discuz

2016-03-02 17:41 507 查看
#/usr/local/nginx/sbin/nginx-V
nginxversion:nginx/1.8.0
builtbygcc4.8.220140120(RedHat4.8.2-16)(GCC)
configurearguments:--with-openssl=../openssl-1.0.1m

php:

#php-v
PHP5.6.16(cli)(built:Nov26201507:52:51)
Copyright(c)1997-2015ThePHPGroup
ZendEnginev2.6.0,Copyright(c)1998-2015ZendTechnologies
withZendOPcachev7.0.6-dev,Copyright(c)1999-2015,byZendTechnologies
withXdebugv2.3.3,Copyright(c)2002-2015,byDerickRethans
备注:实际是php5.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-confignotfound.Pleasecheckyoulibxml2installation

解决:yuminstalllibxml2libxml2-devel

<2>configure:error:pleasereinstallthelibcurldistributioneasy.h....

解决:yuminstalllibcurlcurl-devel

<3>configure:error:jepglib.hnotfound

解决:yuminstalllibjpeglibjpeg-devel

<4>error:png.hnotfound

解决:yuminstalllibpnglibpng-devel

<5>freetype-confignotfound

解决:yuminstallfreetype-devel

<6>mcrypt.hnotfoundpleasereinstalllimcrypt

解决:yum安装limcrypt会失败下载libmcrypt-2.5.7.tar.gz编译安装

<7>error:Don'tkonwhowtodefinestructflockonthissystemset--enable-opcache=no

解决:编辑/etc/ld.so.conf(库文件)加入/usr/local/lib再执行ldconfig-v
注:网上有说法是64位操作系统用/usr/local/lib64结果试了不行

configure好了之后
make
makeinstall

二、

#pwd
/root/soft/php-5.6.12
#cpphp.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!$
#刷新系统环境

[/code]

四、

[root@testfpm]#cpphp-fpm.conf/usr/local/php/etc/php-fpm.conf
[root@testfpm]#pwd
/root/soft/php-5.6.12/sapi/fpm


五、

[root@testfpm]#/usr/local/php/sbin/php-fpm-t
[01-Mar-201617:19:47]NOTICE:configurationfile/usr/local/php/etc/php-fpm.conftestissuccessful

六、

[root@rootfpm]#servicephp-fpmstart
Startingphp-fpm[01-Mar-201617:20:33]ERROR:[poolwww]cannotgetuidforuser'www'
[01-Mar-201617:20:33]ERROR:FPMinitializationfailed
failed

解决:useraddwww

七、
配置nginx
这里走了不少弯路

server{
listen3335;
server_namelocalhost;
indexindex.htmlindex.htmindex.php;
root/var/www;

location~\.php${

fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/var/www$fastcgi_script_name;
includefastcgi_params;
}
}
八、

二级域名配置:

server{
listen80;
server_namebbs.xxx.com;
indexindex.htmlindex.htmindex.php;
root/var/www/html;

location~\.php${

fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/var/www/html$fastcgi_script_name;
includefastcgi_params;
}
}

server{
listen80;
server_namebbs.yyyy.com;
indexindex.htmlindex.htmindex.php;
root/var/www/html;

location~\.php${

fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/var/www/html$fastcgi_script_name;
includefastcgi_params;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: