查看安装包目录:
将安装包解压到指定目录(/app/apps/)下:
tarzxvf /tmp/software/nginx-1.10.1.tar.gz -C /app/apps/.
转到安装目录执行
cd/app/apps/nginx-1.10.1
./configure
显然报错了。
Gcc安装(gcc-6.2.0.tar.bz2)
cd/tmp/software
unzipgcc-4.4.7-4.el6.x86_64.zip
cd /tmp/software/gcc-4.4.7-4.el6.x86_64
依次执行:
rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm
rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm
rpm -ivh cpp-4.4.7-4.el6.x86_64.rpm
rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
rpm -ivh gcc-4.4.7-4.el6.x86_64.rpm
安装完gcc接着安装nginx
cd /app/apps/nginx-1.10.1
执行./ configure
又安装PCRE库
cd/tmp/software
unzippcre-8.39.zip
为防止pcre-8.39安装文件夹被删除掉,将gcc文件夹挪到/app/apps下。
mv/tmp/software/pcre-8.39 /app/apps
cd /app/apps/pcre-8.39
./configure
报错,要安装gcc-c++
cd /tmp/software
rpm-ivh libstdc++-4.4.7-4.el6.x86_64.rpm
rpm-ivh libstdc++-devel-4.4.7-4.el6.x86_64.rpm
rpm-ivh gcc-c++-4.4.7-4.el6.x86_64.rpm
好,gcc-c++安装好了,接着执行configure编译安装gcc
cd/app/apps/pcre-8.39/
./configure
make
makeinstall
好,pcre库安装成功。接着返回去安装nginx;
cd /app/apps/nginx-1.10.1
./configure
还得装zlib
cd/tmp/software
解压zlib到/app/apps下
tarzxvf /tmp/software/zlib-1.2.8.tar.gz -C /app/apps/
cd/app/apps/zlib-1.2.8/
./configure
make
makeinstall
安装好zlib接着返回去装nginx;
cd /app/apps/nginx-1.10.1
./configure
没报错;
make
makeinstall
启动Nginx出现的问题:
/usr/local/nginx/sbin/nginx
1、/usr/local/nginx/sbin/nginx:error while loading shared libraries: libpcre.so.1: cannot open shared objectfile: No such file or directory
从错误看出是缺少lib文件导致,进一步查看下
ldd $(which /usr/local/nginx/sbin/nginx)
linux-gate.so.1 => (0x0071b000)
libpthread.so.0 => /lib/libpthread.so.0 (0×00498000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0×00986000)
libpcre.so.1 => not found
libcrypto.so.6 => /lib/libcrypto.so.6 (0×00196000)
libz.so.1 => /lib/libz.so.1 (0×00610000)
libc.so.6 => /lib/libc.so.6 (0x002d7000)
/lib/ld-linux.so.2 (0x006a8000)
libdl.so.2 => /lib/libdl.so.2 (0x008c3000)
可以看出 libpcre.so.1 => not found并没有找到,进入/lib64目录中手动链接下
cd /lib64
ln -s libpcre.so.0.0.1 libpcre.so.1
/usr/local/nginx/sbin/nginx
然后在启动nginx ok了
哎呀我曹。好了。
nginx启动命令:
/usr/local/nginx/sbin/nginx
修改配置文件的时候修改/usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx -c/usr/local/nginx/conf/nginx.conf
相关资源:
链接:http://pan.baidu.com/s/1hseGucW 密码:r2ps