首页 > Web开发 > 详细

nginx安装CentOS6,支持php

时间:2015-06-12 15:10:28      阅读:249      评论:0      收藏:0      [点我收藏+]

1. Install nginx from Ngnix web with stable version
vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/x86_64/
gpgcheck=0
enabled=1

yum -y install nginx

vi /etc/nginx/nginx.conf
#set it within number of CPU cores
worker_processes 2;
#uncomment ( enable gzip )
gzip on;

vi /etc/nginx/conf.d/default.conf
#change to your server‘s name
server_name 192.168.2.5;

service nginx start; chkconfig nginx on

2. enable centos 6 updates repo
yum -y install php php-mbstring php-pear php-fpm

vi /etc/php.ini
date.timezone = Asia/Shanghai
expose_php = Off
magic_quotes_gpc = Off
short_open_tag = On

vi /etc/php-fpm.d/www.conf
user = nginx
group = nginx

service php-fpm start; chkconfig php-fpm on

vi /etc/nginx/conf.d/default.conf
# add follows in a "server" section
location ~ \.php$ {
        root   /usr/share/nginx/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        /etc/nginx/fastcgi_params;
    }

service nginx restart

echo "<?php phpinfo() ?>" > /usr/share/nginx/html/info.php


本文出自 “Ilovecat(个人笔记)” 博客,请务必保留此出处http://hj192837.blog.51cto.com/655995/1661169

nginx安装CentOS6,支持php

原文:http://hj192837.blog.51cto.com/655995/1661169

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!