REHL5.4 配置nginx1.2.0 PHP5.3.10

安装包下载
php5:wget http://cn2.php.net/get/php-5.3.10.tar.bz2/from/cn.php.net/mirror
nginx1.2:wget http://nginx.org/download/nginx-1.0.14.tar.gz


安装nginx1.2
#tar xzvf nginx-1.2.0.tar.gz
#cd nginx--1.2.0
#./configure --prefix=/usr/local/nginx
#make && make install
安装成功
#ln -s /usr/local/nginx/sbin/nginx /etc/init.d/nginx
#pkill -9 nginx 强制停止
#service nginx 开始
#nginx -s reload 重启
#echo “/usr/local/nginx/sbin/nginx” >>/etc/rc.local 自动启动



可能出现错误
1、./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
需要安装库
yum  install pcre-devel


安装php-5.3.10
#tar xvf php-5.3.10.tar.bz2
#cd php-5.3.10
#./configure --prefix=/usr/local/php5 --enable-mbstring  --enable-fpm --with-jpeg-dir --with-png-dir --with-gd --with-freetype-dir --with-gd --with-mysql=/usr/local/mysql
注 mysql的路径根据你实际安装的路径选择
#make && make install
#cp php.ini-development /usr/local/php5/lib/php.ini
#vi /usr/local/php5/lib/php.ini
修改 date.timezone = PRC 去掉前面的 ;
#cd /usr/local/php5/etc/
#cp php-fpm.conf.default php-fpm.conf
启动php-fpm
/usr/local/php5/sbin/php-fpm
查看是否启动,看到9000端口表示启动成功

#netstat -antp |grep :9000 

安装过程中可能遇见的问题:
1、configure: error: xml2-config not found. Please check your libxml2 installation.
安装rpm -ivh apt-get install libxml2-dev
2、configure: error: Please reinstall the libcurl distribution -easy.h should be in <curl-dir>/include/curl/
安装rpm -ivh apt-get install libcurl4-gnutls-dev
3、configure: error: jpeglib.h not found.
安装rpm -ivh libjpeg-dev
4、If configure fails try –with-vpx-dir=<DIR>configure: error: png.h not found.
安装rpm -ivh apt-get install libpng12-dev
5、If configure fails try –with-xpm-dir=<DIR>configure: error: freetype.h not found.
安装rpm -ivh apt-get install libfreetype6-dev
6、configure: error: mcrypt.h not found. Please reinstall libmcrypt.
安装rpm -ivh apt-get install libmcrypt-dev
7、configure: error: Cannot find libtidy
安装rpm -ivh apt-get install libtidy-dev

配置,增加蓝色部分内容,注意web的路径
#vi /usr/local/nginx/conf/nginx.conf

    ...略

   server
    {
          listen  80;
          server_name  www.ming-soft.com
          location / {
            root   /web;
            index  index.html index.htm index.php;
          }


          location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /web/$fastcgi_script_name;
            include        fastcgi_params;
          }

    }
   ...略


如果以上不用户不使用rpm安装,可能会出现下面的错误
1、编译gd-2.0.35.tar.gz时报错:
gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/local/freetype/include/freetype2 -I/usr/local/freetype/include -I/usr/local/freetype/include -I/usr/local/jpeg/include -g -O2 -MT gd_png.lo -MD -MP -MF .deps/gd_png.Tpo -c gd_png.c -fPIC -DPIC -o .libs/gd_png.o
gd_png.c:16:53: error: png.h: No such file or directory
gd_png.c:47: error: expected specifier-qualifier-list before ‘jmp_buf’
gd_png.c:54: error: expected ‘)’ before ‘png_ptr’
gd_png.c:82: error: expected ‘)’ before ‘png_ptr’
gd_png.c:92: error: expected ‘)’ before ‘png_ptr’
解决办法:
#vi gd_png.c

#include “png.h”              /* includes zlib.h and setjmp.h */ 
替换成:
#include “/usr/local/libpng/include/png.h”              /* includes zlib.h and setjmp.h */
然后再make就可以了
注:include“”双引号里包含的是libpng安装的路径里的include文件夹里的png.h文件
2、expat错误:
checking expat.h usability... no 
checking expat.h presence... no 
checking for expat.h... no 
checking xmlparse.h usability... no 
checking xmlparse.h presence... no 
checking for xmlparse.h... no 
configure: error: Cannot find usable expat library. This could mean that your version is too old.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值