1.准备
- centos6.5
- nginx-1.19.3.tar.gz源码包
2.安装依赖
[root@es-node03 opt]# yum install pcre-devel openssl-devel zlib-devel
3.解压
[root@es-node03 opt]# ls -rlt
total 1032
drwxr-xr-x. 2 root root 4096 Nov 22 2013 rh
-rw-r--r-- 1 root root 1052581 Oct 17 15:01 nginx-1.19.3.tar.gz
[root@es-node03 opt]# tar -xvf nginx-1.19.3.tar.gz
...
[root@es-node03 opt]# ls -rlt
total 1036
drwxr-xr-x. 2 root root 4096 Nov 22 2013 rh
drwxr-xr-x 8 1001 1001 4096 Sep 29 22:32 nginx-1.19.3
-rw-r--r-- 1 root root 1052581 Oct 17 15:01 nginx-1.19.3.tar.gz
4.编译
[root@es-node03 opt]# cd nginx-1.19.3
...
[root@es-node03 nginx-1.19.3]# ./configure --prefix=/opt/nginx
4.1报错
checking for OS
+ Linux 2.6.32-431.el6.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found
[root@es-node03 nginx-1.19.3]# gcc -v
-bash: gcc: command not found
#没有gcc,安装gcc
[root@es-node03 nginx-1.19.3]# yum -y install gcc gcc-c++
[root@es-node03 nginx-1.19.3]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
4.2重新编译
[root@es-node03 nginx-1.19.3]# ./configure --prefix=/opt/nginx
[root@es-node03 nginx-1.19.3]# make
[root@es-node03 nginx-1.19.3]# make install
[root@es-node03 nginx-1.19.3]# cd /opt/nginx
[root@es-node03 nginx]# ls -rlt
total 16
drwxr-xr-x 2 root root 4096 Nov 7 14:46 sbin
drwxr-xr-x 2 root root 4096 Nov 7 14:46 conf
drwxr-xr-x 2 root root 4096 Nov 7 14:46 logs
drwxr-xr-x 2 root root 4096 Nov 7 14:46 html
5.启动
[root@es-node03 nginx]# ./sbin/nginx
5.1验证
浏览器输入相应ip地址,查看是否能看到欢迎界面
2020-11-07_145906.jpg
网友评论