码迷,mamicode.com
首页 > 其他好文 > 详细

centos 6.5 安装配置nginx环境

时间:2015-10-10 12:20:14      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:

1.安装pcre ,zlib ,openssl

yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel

 

2.安装nginx

rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum -y install nginx
yum -y php-fpm
service php-fpm restart
service nginx restart
chkconfig php-fpm on
chkconfig nginx on

打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。

 

3.常用命令

service nginx start
service nginx stop
service nginx reload

 

4.常用配置

vi /etc/nginx/conf.d/default.conf

server {
    listen       80;
    server_name  localhost;
    autoindex    on;
    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        root   /var/www/html;
        index  index.html index.htm index.php;
    }

    location ~ \.php$ {
        root           /var/www/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
        include        fastcgi_params;
    }

 

centos 6.5 安装配置nginx环境

标签:

原文地址:http://www.cnblogs.com/tiger2soft/p/4866058.html

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