首页 > 代码库 > 安装Nginx

安装Nginx

安装nginx

官网:http://nginx.org/

端口号:80

nginxweb机器

 

cd /usr/local/src

wgethttp://101.110.118.72/nginx.org/download/nginx-1.6.3.tar.gz

tar -zxvf nginx-1.6.3.tar.gz

cd nginx-1.6.3

yum install -y gcc

yum install -y zlib-devel

yum install -y pcre-devel                                       #编译时用到pcre

./configure --prefix=/usr/local/nginx--with-pcre

make && make install

/usr/local/nginx/sbin/nginx                                 #启动nginx

 

解析php

vim /usr/local/nginx/conf/nginx.conf                         #去掉注释

location ~ \.php$ {

           root           html;

           fastcgi_pass   127.0.0.1:9000;

           fastcgi_index  index.php;

           fastcgi_param SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;

           include        fastcgi_params;

       }

/usr/local/nginx/sbin/nginx –t                                               #检查nginx配置是否有误

/usr/local/nginx/sbin/nginx -s reload                                   #重新加载nginx配置文件

 

 

 

 

 

 

 

 

 

 

 

 

 


本文出自 “11736718” 博客,请务必保留此出处http://11746718.blog.51cto.com/11736718/1876248

安装Nginx