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

Fedora 下nginx和php的安装

时间:2015-05-30 14:59:04      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:nginx   php5   

1. nginx的安装

  • nginx安装
wget https://github.com/nginx/nginx/archive/v1.7.11.zip
unzip nginx-1.7.7.zip
./configure --prefix=NGINX_INSTALL_PATH
make 
make -f objs/Makefile install
nginx直接在objs下生成Makefile文件.
  • nginx模块安装

    nginx模块和apache模块最大的区别在于其添加模块需要重新编译文件.下面展示下nginx-echo模块的安装.

    wget https://github.com/openresty/echo-nginx-module/archive/v0.57.zip
    mkdir $NGINX_INSTALL_PATH/modules
    mv echo-nginx-module-0.57.zip $NGINX_INSTALL_PATH/modules  && cd $NGINX_INSTALL_PATH/modules
    unzip echo-nginx-module-0.57.zip 
    cd $NGINX_INSTALL_PATH
    ./configure --prefix=NGINX_INSTALL_PATH --add-module=$NGINX_INSTALL_PATH/modules/echo-nginx-module-0.5

2. mysql 安装

mysql安装可以直接到mysql官网下载repo文件.

wget http://repo.mysql.com/mysql-community-release-fc21-6.noarch.rpm
sudo yum install community-mysql-server.x86_64 mysql-workbench-community.x86_64

3. php安装

这里主要用到php-fpm来负责执行php文件,在php内核5.3.3以上,php源码自带php-fpm

wget -c http://cn2.php.net/distributions/php-5.6.9.tar.gz(由于php文件较大,最好开启断点续传)
./configure --prefix=/usr/local/php-5.6.9 --enable-fpm --with-mysql
make && make install
sudo ln -s /usr/local/php-5.6.9 /usr/local/php

这样我们就安装好php,然后运行php-fpm,不过在这之前,需要将

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

我们现在就用里面的默认配置,然后到sbin目录下开启php-fpm服务.

sudo sbin/php-fpm

4. nginx下配置php

 location ~* \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            include fastcgi_params;
        }

现在start nginx
在html目录添加index.php文件.

<?php
phpinfo();
?>

访问http://localhost/index.php
出现
技术分享
这样nginx和php的安装配置就完成了.

Fedora 下nginx和php的安装

标签:nginx   php5   

原文地址:http://blog.csdn.net/zpllwy/article/details/46273769

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