原文出处:
有台我维护的服务器,没有 root 权限,只有普通用的权限。现在想安装 nginx 做负载均衡。
下载
用- ./configure --prefix=/home/admin/nginx
会报下载的错:
./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= option.
把 pcre 安装
- ./configure --prefix=/home/admin/usr-local
- make
- make install
然后安装 nginx
- cd ~/src/nginx-0.8.54
- ./configure --prefix=/home/admin/nginx --with-pcre=/home/admin/usr-local
配置正确了
Configuration summary
+ using PCRE library: /home/admin/usr-local + OpenSSL library is not used + md5: using system crypto library + sha1 library is not used + using system zlib library
nginx make 的时候报错:
make -f objs/Makefile
make[1]: Entering directory `/home/admin/src/nginx-0.8.54' cd /home/admin/usr-local \ && if [ -f Makefile ]; then make distclean; fi \ && CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \ ./configure --disable-shared /bin/sh: line 2: ./configure: No such file or directory make[1]: *** [/home/admin/usr-local/Makefile] Error 127 make[1]: Leaving directory `/home/admin/src/nginx-0.8.54' make: *** [build] Error 2
这个我想不明白了。安装了 pcre 还有问题。网上找到答案
--with-pcre=DIR 是指 pcre 的源码目录,而不是 pcre 的安装目录。改了后顺利安装
- ./configure --prefix=/home/admin/nginx --with-pcre=/home/admin/src/pcre-8.11 --user=admin
- make
- make install
但 make 时还有个警告:
objs/src/os/unix/ngx_process.o: In function `ngx_process_get_status':
/home/admin/src/nginx-0.8.54/src/os/unix/ngx_process.c:490: warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead /home/admin/src/nginx-0.8.54/src/os/unix/ngx_process.c:490: warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead make[1]: Leaving directory `/home/admin/src/nginx-0.8.54'
看起来问题不大。
关于 nginx 的安装选项可以看
关于 nginx 负载均衡可以看 ,
感谢博文: