安装 nginx

大家好我是钟义林,今天我们来安装一个nginx服务

我们安装1.3.9这个包吧

首先需要下载一个nginx包

wget http://nginx.org/download/nginx-1.3.9.tar.gz


然后我们去 /usl/local/ 下 vi一个shell,这里我为写blog专门mkdir了一个51cto的目录

#!/bin/sh


cd /opt


tar zxvf nginx-1.3.9.tar.gz


cd nginx-1.3.9


./configure --prefix=/usr/local/nginx-1.3.9 --with-http_ssl_module \

--with-http_stub_status_module \

--with-http_flv_module


make && meke install


写完shell有wq保存退出,切记赋权,不然会告诉你权限不够

chmod 755 nginx.sh

然后执行

/usr/local/51cto/ngingx.sh

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

如果你出现了这样的错误

那说明你少装个库,用yum来把它装上

yum install pcre-devel pcre-static

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


 安装成功后我们需要在/usr/local/nginx-1.3.9/conf/nginx.conf里面该些设置,当然非常简单,是为了让nginx支持php

#location ~ \.php$ {

       #    root           html;

       #    fastcgi_pass   127.0.0.1:9000;

       #    fastcgi_index  index.php;

       #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

       #    include        fastcgi_params;

       #}

就是这一段,只要把前面的#(注释符)去掉就行。

https是https加密通道,就是证书之类,我这次用不到就不配置了

配置完后记得:wq保存退出

不要着急启动服务,我们这个时候检查一下防火墙状态,如果开了就吧防火墙关了

启动nginx服务 /usr/local/nginx-1.3.9/sbin/nginx


最后用浏览器查看一下


这下你的nginx算了安装成功了


Thank

你可能感兴趣的:(nginx)