标签:nginx
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
原文地址:http://hj192837.blog.51cto.com/655995/1661169