码迷,mamicode.com
首页 > Web开发 > 详细

Linux下安装nginx和php

时间:2015-11-17 18:27:12      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:

1. 安装nginx,传送门:http://www.cnblogs.com/emberd/p/4536238.html
2. 下载php源码压缩包:php-5.6.1.tar.gz
3. 解压后进入目录,执行编译前配置

./configure --prefix=/usr/local/php5.6.1 --enable-mbstring --with-mcrypt --with-mhash --enable-fpm --with-iconv

中途会报错缺少依赖库,依次安装

libxml2:

yum install -y libxml2-devel

libmcrypt:

源码安装libmcrypt-2.5.7.tar.gz

4. 修改MakeFile文件

1 vim Makefile
2 EXTRA_LIBS=后加上-liconv
3 make
4 make install

5. 修改php配置文件

1 cd /usr/local/php5.6.1/etc
2 cp php-fpm.conf.default php-fpm.conf
3 修改如下参数:
4 pm.max_children = 40
5 pm.start_servers = 20
6 pm.min_spare_servers = 5
7 pm.max_spare_servers = 35
8 pm.max_requests = 500
9 listen = 127.0.0.1:40000

6. 启动php-fpm

usr/local/php5.6.1/sbin/php-fpm &

7. 修改nginx配置文件

location / {
    root   /data/www;
    index  index.html index.htm;
}

location ~ \.php$ {
    root           /data/www;
    fastcgi_pass   127.0.0.1:40000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME /data/www$fastcgi_script_name;
    include        fastcgi_params;
}

8. 重载nginx

/usr/local/nginx/sbin/nginx -s reload

 

Linux下安装nginx和php

标签:

原文地址:http://www.cnblogs.com/emberd/p/4972398.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!