下面是我安装的过程和其中遇到的问题
1.wget http://nginx.org/download/nginx-1.2.3.tar.gz(获取nginx安装包,放在/opt/)
2.cd opt
3.tar zxvf nginx1.2.3
4. cd nginx1.2.3
5. ./configure --prefix=/usr/local/nginx(nginx安装目录) --with-http_stub_status_module(
为了启用 nginx 的 NginxStatus 功能,用来监控 Nginx 的当前状态。)
输出信息包含:
./configure: error: the HTTP rewrite modulerequires the PCRE library.
You can either disable the module by using--without-http_rewrite_module
option, or install the PCRE library intothe system, or build the PCRE library
statically from the source with nginx byusing --with-pcre=<path> option.
我发现需要安装pcre(正则表达式库)6.下载pcre,从ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
tar –zxvf pcre-8.21.tar.gz下载
7.tar zxvf pcre-8.21.tar.gz
8.在pcre目录下 ./configure --prefix=/usr/local/pcre(我习惯把各个软件都装在自己的目录下,但是我没有考虑pcre不同于一般的应用程序,它是一个库,这样导致我后来还是出现错误了)
9.make(编译)
10.make install (安装)
11.回来继续装nginx ./configure --prefix=/usr/local/nginx --with-http_stub_status_module
还是提示我
./configure: error: the HTTP rewrite modulerequires the PCRE library.
You can either disable the module by using--without-http_rewrite_module
option, or install the PCRE library intothe system, or build the PCRE library
statically from the source with nginx byusing --with-pcre=<path> option.
但是我已经安装了pcre库,(我猜测可能跟我把pcre安装找指定目录有关,我指定了pcre目录重新执行./configure)./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-pcre=/opt/pcre-8.21(这个是pcre的安装包的目录,不是安装目录)
这样就ok了
12.make
13.make install
14. cd /usr/local/nginx/sbin
15.-nginx -t(test configuration and exit)
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
安装成功
16.在sbin目录下./nginx 启动nginx
17. sbin目录下nginx -s stop(stop nginx)(-s signal : send signal to a master process: stop, quit, reopen, reload )