Nginx学习

1. 配置nginx第三方源

wget http://www.atomicorp.com/installers/atomic
sh atomic

2. 安装nginx

yum install -y nginx
service nginx start
chkconfig --level 235 nginx on

3. 安装mysql

yum install -y mysql mysql-server mysql-devel
service mysqld start
chkconfig --level 235 mysqld on

4. 安装php以及组件,以及FastCGI模式

yum install -y php lighttpd-fastcgi php-common php-devel php-fpm php-mysql
service php-fpm start
chkconfig --level 235 php-fpm on

5. 配置nginx支持php

mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak  备份
cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf  修改默认文件
vi /etc/nginx/nginx.conf 修改nginx配置文件,添加fastcgi支持
location /{
root /www;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www$fastcgi_script_name;
include fastcgi_params;
}

 

posted @ 2016-07-27 21:51  天津饭2015  阅读(130)  评论(0编辑  收藏  举报