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
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
这里主要用到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
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的安装配置就完成了.
原文地址:http://blog.csdn.net/zpllwy/article/details/46273769