当前位置:首页 » Linux技术知识

linux下安装nginx-1.8.0

2015-08-24 17:24 本站整理 浏览(44)
1.下载网址:http://nginx.org/en/download.html
选择nginx-1.8.0
2.安装
tar zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0/
./configure --prefix=/home/wangpl/mine/soft/nginx-1.8.0
error:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
意思是rewrite模块需要的pcre没有找到,需要指定--with-pcre=<path>
可以参考:http://blog.csdn.net/conquer0715/article/details/42555723
安装pcre
从http://pcre.org/下载:pcre-8.36.tar.gz
tar zxvf pcre-8.36.tar.gz
cd xx/pcre-8.36
./configure --prefix=/home/soft/pcre-8.36
make
make install
继续nginx安装(这里直接禁用rewrite模块):
./configure --prefix=/home/wangpl/mine/soft/nginx-1.8.0 --without-http_rewrite_module
安装完成
相比Apache httpd简单多了,不到3MB,当然功能也相对少点,网上说性能较Apache要好,但稳定性要差点。
3.试用
cd /home/wangpl/mine/soft/nginx-1.8.0/sbin
./nginx
访问:http://127.0.0.1:7000/
看到以下结果表示启动成功:

Welcome to nginx!

停止nginx:
./nginx -s stop