nginx php 源码安装,nginx+php编译安装

1、安装前准备:

yum -y install gcc automake autoconf libtool make gcc-c++ glibc \

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

2、新版php-fpm编译安装(推荐安装方式)

wget http://cn2.php.net/distributions/php-5.6.10.tar.gz

tar zvxf php-5.6.10.tar.gz

cd php-5.6.10

./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

make all install

3、对php-fpm运行用户进行设置

cd /usr/local/php

cp etc/php-fpm.conf.default etc/php-fpm.conf

4、编译安装nginx

tar zxvf nginx-1.8.0.tar.gz

cd nginx-1.8.0

./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_stub_status_module \

--with-http_spdy_module --with-http_gzip_static_module --with-http_flv_module \

--with-http_mp4_module --with-http_ssl_module --with-pcre=/root/pcre-8.37 \

--with-openssl=/root/openssl-1.0.1p --with-zlib=/root/zlib-1.2.8

make && make install

5、修改nginx配置文件

vi /usr/local/nginx/conf/nginx.conf

其中server段增加如下配置:

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;

}

6、创建测试php文件

创建php文件

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

echo phpinfo();

?>

7、启动服务

启动php-fpm:

/usr/local/php/sbin/php-fpm

启动nginx:

/usr/local/nginx/sbin/nginx

8、浏览器访问

访问http://你的服务器ip/index.php,就可以见到php信息了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值