首页 > IT职业 > IT职场 > linux安装nginx
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
PCRE 作用是让 Nginx 支持 Rewrite 功能。
[root@bogon src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[root@bogon src]# tar zxvf pcre-8.35.tar.gz
[root@bogon src]# cd pcre-8.35
[root@bogon pcre-8.35]# ./configure
[root@bogon pcre-8.35]# make && make install
[root@bogon pcre-8.35]# pcre-config --version
下载地址:http://nginx.org/download/nginx-1.6.2.tar.gz
[root@bogon src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz
[root@bogon src]# tar zxvf nginx-1.6.2.tar.gz
[root@bogon src]# cd nginx-1.6.2
[root@bogon nginx-1.6.2]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
[root@bogon nginx-1.6.2]# make
[root@bogon nginx-1.6.2]# make install
[root@bogon nginx-1.6.2]# /usr/local/webserver/nginx/sbin/nginx -v
[root@bogon conf]# /usr/local/nginx/sbin/nginx -t
Nginx 启动命令如下:
[root@bogon conf]# /usr/local/nginx/sbin/nginx
make -f objs/Makefile
make[1]: Entering directory /home/data/soft/nginx-1.6.2' cd /usr/local/src/pcre-8.35 \ && if [ -f Makefile ]; then make distclean; fi \ && CC="cc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \ ./configure --disable-shared /bin/sh: 1: cd: can't cd to /usr/local/src/pcre-8.35 make[1]: *** [/usr/local/src/pcre-8.35/Makefile] Error 2 make[1]: Leaving directory/home/data/soft/nginx-1.6.2’
make: *** [build] Error 2
报错位置为:/usr/local/src/pcre-8.35
解决办法:
root@vagrant-ubuntu-trusty:/home/data/soft/nginx-1.6.2# ./configure --help | grep '--with-pcre'
--with-pcre force PCRE library usage
--with-pcre=DIR set path to PCRE library sources
--with-pcre-opt=OPTIONS set additional build options for PCRE
--with-pcre-jit build PCRE with JIT compilation support
参数:–with-pcre=DIR 指定路径为安装包源码位置
本机源码包安装位置:/home/data/soft/pcre-8.35
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/home/data/soft/pcre-8.35/
make && make install
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3244/viewspace-2815821/ ,如需转载,请注明出处,否则将追究法律责任。