- 1、必要软件准备
安装 pcre
为了支持 rewrite 功能,我们需要安装 pcre
# yum install pcre* //如过你已经装了,请跳过这一步
安装 openssl
需要 ssl 的支持,如果不需要 ssl 支持,请跳过这一步
# yum install openssl* - 安装 zlib
需要 gzip压缩,
# yum install zlib* - 2、 安装nginx
执行如下命令:
# ./configure --prefix=/usr/local/nginx-1.5.1
--with-http_ssl_module --with-http_spdy_module
--with-http_stub_status_module --with-pcre
–with-http_stub_status_module:支持 nginx 状态查询
–with-http_ssl_module:支持 https
–with-http_spdy_module:支持 google 的 spdy,想了解请百度 spdy,这个必须有 ssl 的支持
–with-pcre:为了支持 rewrite 重写功能,必须制定 pcre
最后输出如下内容,表示 configure OK 了。 - # make //确定你的服务器有安装 make,如果没有安装请执行 yum install make
# make install - 3、启动、关闭、重置nginx
启动:直接执行以下命令,nginx 就启动了,不需要改任何配置文件,
/usr/local/nginx-1.5.1/sbin/nginx
试试访问:我这边不贴图,直接使用 curl 命令来读取 web 信息
[root@ns conf]# curl -s http://localhost
关闭:
/usr/local/nginx-1.5.1/sbin/nginx -s stop
重置:当你有修改配置文件的时候,只需要 reload 以下即可
/usr/local/nginx-1.5.1/sbin/nginx -s reload
整个 nginx 的安装就到这里结束了