本空间内容都是自己的随记,转载请注明出处!

centos下php-fpm和nginx环境

上一篇 / 下一篇  2014-02-13 09:47:41 / 个人分类:测试环境

1、准备各种软件,php5.0以上的自导fpm,无需单独安装,只需要在编译的时候enable就行。编译安装php
./configure --prefix=/usr/local/php  --enable-fpm --with-mcrypt --with-zlib --enable-mbstring --disable-pdo --with-curl --disable-debug --with-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-libxml-dir=/usr --enable-xml --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash  --enable-zip --with-pcre-regex --with-mysql --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir=/usr --with-openssl --with-jpeg-dir=/usr --with-png-dir=/usr
2、编译安装nginx
3、php扩展组件的单独安装,进入php安装程序的ext目录php-5.4.7/ext。
举例
cd pdo
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-pdo=shared
make
make install
4、php.ini配置修改
extension_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/"
extension = "memcache.so"
extension = "yaf.so"
extension = "memcached.so"
extension = "redis.so"
extension = "pdo_mysql.so"
yaf.environ="test"
[yaf]
yaf.use_spl_autoload = "On"
5、nginx配置修改vi /usr/local/nginx/conf/nginx.conf
server {
   listen       80;
   server_name  192.168.0.212 localhost;
   access_log  logs/access.log ;
   location / {
            root   /usr/local/nginx/html;
            index  index.html index.php;
            if ( !-e $request_filename ) {
                    rewrite ^/(.*)  /index.php last;
            }
    }
    location ~.php$ {
            root /usr/local/nginx/html;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    }
}
----上段是默认服务器ip访问
server {
   listen       80;
   server_name  xx.xx.com;
   access_log  logs/xx.xx.com.log ;
   location / {
            root   /home/php/wwwFront/develop/application/www;
            index  index.html index.php;
            if ( !-e $request_filename ) {
                    rewrite ^/(.*)  /index.php last;
            }
    }
    location ~.php$ {
            root /home/php/bwwwFront/develop/application/www;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    }
}
----------虚拟主机配置
 
 
6、启动php-fpm和nginx:shell
#/bin/sh
killall -9 php-fpm
echo "stop php..."
/usr/local/php/sbin/php-fpm
echo "start php"
killall -9 nginx
echo "stop nginx"
/usr/local/nginx/sbin/nginx
echo "start nginx"
7、测试。在/usr/local/nginx/html写一个php文件,index.php,查看php的相关信息
<?php
phpinfo();
?>

TAG:

 

评分:0

我来说两句

日历

« 2024-04-26  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 14606
  • 日志数: 15
  • 图片数: 1
  • 文件数: 1
  • 建立时间: 2007-04-24
  • 更新时间: 2014-02-13

RSS订阅

Open Toolbar