赞
踩
/usr/local/nginx/conf/nginx.conf
[root@localhost sbin]# cd /usr/local/nginx/conf/
[root@localhost conf]# ll
总用量 68
-rw-r--r--. 1 root root 1077 7月 11 18:53 fastcgi.conf
-rw-r--r--. 1 root root 1077 7月 11 18:53 fastcgi.conf.default
-rw-r--r--. 1 root root 1007 7月 11 18:53 fastcgi_params
-rw-r--r--. 1 root root 1007 7月 11 18:53 fastcgi_params.default
-rw-r--r--. 1 root root 2837 7月 11 18:53 koi-utf
-rw-r--r--. 1 root root 2223 7月 11 18:53 koi-win
-rw-r--r--. 1 root root 5231 7月 11 18:53 mime.types
-rw-r--r--. 1 root root 5231 7月 11 18:53 mime.types.default
-rw-r--r--. 1 root root 2656 7月 11 18:53 nginx.conf
-rw-r--r--. 1 root root 2656 7月 11 18:53 nginx.conf.default
-rw-r--r--. 1 root root 636 7月 11 18:53 scgi_params
-rw-r--r--. 1 root root 636 7月 11 18:53 scgi_params.default
-rw-r--r--. 1 root root 664 7月 11 18:53 uwsgi_params
-rw-r--r--. 1 root root 664 7月 11 18:53 uwsgi_params.default
-rw-r--r--. 1 root root 3610 7月 11 18:53 win-utf
[root@localhost conf]# pwd
/usr/local/nginx/conf
[root@localhost ~]# cd /opt/
[root@localhost opt]# mkdir tool
[root@localhost opt]# cd tool/
[root@localhost tool]# mkdir nginx
[root@localhost tool]# cd nginx/
[root@localhost nginx]# pwd
/opt/tool/nginx
[root@localhost nginx]#
[root@localhost nginx]# pwd
/opt/tool/nginx
[root@localhost nginx]# ls
nginx-1.20.1.tar.gz openssl-1.0.1t.tar.gz pcre-8.37.tar.gz zlib-1.2.8.tar.gz
[root@localhost nginx]#
[root@localhost nginx]# yum install gcc
已加载插件:fastestmirror, langpacks | 2.9 kB 00:00:00
Determining fastest mirrors
* base: mirrors.nju.edu.cn
* centos-sclo-rh: mirrors.nju.edu.cn
* centos-sclo-sclo: mirrors.163.com
* extras: mirrors.nju.edu.cn
* updates: mirrors.nju.edu.cn
软件包 gcc-4.8.5-44.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost nginx]# yum install gcc-c++
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.nju.edu.cn
* centos-sclo-rh: mirrors.nju.edu.cn
* centos-sclo-sclo: mirrors.163.com
* extras: mirrors.nju.edu.cn
* updates: mirrors.nju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 gcc-c++.x86_64.0.4.8.5-44.el7 将被 安装
--> 正在处理依赖关系 libstdc++-devel = 4.8.5-44.el7,它被软件包 gcc-c++-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 libstdc++ = 4.8.5-44.el7,它被软件包 gcc-c++-4.8.5-44.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libstdc++.x86_64.0.4.8.5-16.el7 将被 升级
---> 软件包 libstdc++.x86_64.0.4.8.5-44.el7 将被 更新
---> 软件包 libstdc++-devel.x86_64.0.4.8.5-44.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================================================================================
Package 架构 版本 源 大小
================================================================================================================================================
正在安装:
gcc-c++ x86_64 4.8.5-44.el7 base 7.2 M
为依赖而安装:
libstdc++-devel x86_64 4.8.5-44.el7 base 1.5 M
为依赖而更新:
libstdc++ x86_64 4.8.5-44.el7 base 306 k
事务概要
================================================================================================================================================
安装 1 软件包 (+1 依赖软件包)
升级 ( 1 依赖软件包)
总计:9.0 M
总下载量:8.7 M
Is this ok [y/d/N]: y
Downloading packages:
gcc-c++-4.8.5-44.el7.x86_64.rp FAILED ] 0.0 B/s | 0 B --:--:-- ETA
http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/gcc-c%2B%2B-4.8.5-44.el7.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found-:--:-- ETA
正在尝试其它镜像。
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
(1/2): libstdc++-devel-4.8.5-44.el7.x86_64.rpm | 1.5 MB 00:00:01
gcc-c++-4.8.5-44.el7.x86_64.rp FAILED
http://mirrors.bupt.edu.cn/centos/7.9.2009/os/x86_64/Packages/gcc-c%2B%2B-4.8.5-44.el7.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found:04 ETA
正在尝试其它镜像。
(2/2): gcc-c++-4.8.5-44.el7.x86_64.rpm | 7.2 MB 00:00:01
------------------------------------------------------------------------------------------------------------------------------------------------
总计 2.4 MB/s | 8.7 MB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : libstdc++-4.8.5-44.el7.x86_64 1/4
正在安装 : libstdc++-devel-4.8.5-44.el7.x86_64 2/4
正在安装 : gcc-c++-4.8.5-44.el7.x86_64 3/4
清理 : libstdc++-4.8.5-16.el7.x86_64 4/4
验证中 : gcc-c++-4.8.5-44.el7.x86_64 1/4
验证中 : libstdc++-devel-4.8.5-44.el7.x86_64 2/4
验证中 : libstdc++-4.8.5-44.el7.x86_64 3/4
验证中 : libstdc++-4.8.5-16.el7.x86_64 4/4
已安装:
gcc-c++.x86_64 0:4.8.5-44.el7
作为依赖被安装:
libstdc++-devel.x86_64 0:4.8.5-44.el7
作为依赖被升级:
libstdc++.x86_64 0:4.8.5-44.el7
完毕!
[root@localhost nginx]# tar -zxvf pcre-8.37.tar.gz
pcre-8.37/
pcre-8.37/pcre_scanner.h
pcre-8.37/LICENCE
pcre-8.37/makevp_c.txt
pcre-8.37/PrepareRelease
pcre-8.37/RunTest.bat
pcre-8.37/pcre16_study.c
pcre-8.37/pcre16_chartables.c
[root@localhost nginx]# cd pcre-8.37/
[root@localhost pcre-8.37]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
[root@localhost pcre-8.37]# make
rm -f pcre_chartables.c
ln -s ./pcre_chartables.c.dist pcre_chartables.c
make all-am
make[1]: 进入目录“/opt/tool/nginx/pcre-8.37”
CC libpcre_la-pcre_byte_order.lo
CC libpcre_la-pcre_compile.lo
CC libpcre_la-pcre_config.lo
CC libpcre_la-pcre_dfa_exec.lo
[root@localhost pcre-8.37]# make install
make install-am
make[1]: 进入目录“/opt/tool/nginx/pcre-8.37”
make[2]: 进入目录“/opt/tool/nginx/pcre-8.37”
/usr/bin/mkdir -p '/usr/local/lib'
[root@localhost nginx]# ll
总用量 8064
-rw-r--r--. 1 root root 1061461 3月 9 2023 nginx-1.20.1.tar.gz
-rw-r--r--. 1 root root 4556447 3月 9 2023 openssl-1.0.1t.tar.gz
drwxr-xr-x. 9 1169 1169 12288 7月 4 23:33 pcre-8.37
-rw-r--r--. 1 root root 2041593 3月 9 2023 pcre-8.37.tar.gz
-rw-r--r--. 1 root root 571091 3月 9 2023 zlib-1.2.8.tar.gz
[root@localhost nginx]# tar -zxvf openssl-1.0.1t.tar.gz
openssl-1.0.1t/ACKNOWLEDGMENTS
openssl-1.0.1t/apps/
openssl-1.0.1t/apps/app_rand.c
openssl-1.0.1t/apps/apps.c
openssl-1.0.1t/apps/apps.h
openssl-1.0.1t/apps/asn1pars.c
[root@localhost nginx]# cd openssl-1.0.1t/
[root@localhost openssl-1.0.1t]# ./config
Operating system: x86_64-whatever-linux2
Configuring for linux-x86_64
Configuring for linux-x86_64
no-ec_nistp_64_gcc_128 [default] OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
no-gmp [default] OPENSSL_NO_GMP (skip dir)
no-jpake [experimental] OPENSSL_NO_JPAKE (skip dir)
no-krb5 [krb5-flavor not specified] OPENSSL_NO_KRB5
no-md2 [default] OPENSSL_NO_MD2 (skip dir)
no-rc5 [default] OPENSSL_NO_RC5 (skip dir)
[root@localhost nginx]# cd openssl-1.0.1t/
[root@localhost openssl-1.0.1t]# make
making all in crypto...
make[1]: 进入目录“/opt/tool/nginx/openssl-1.0.1t/crypto”
making all in crypto/objects...
make[2]: 进入目录“/opt/tool/nginx/openssl-1.0.1t/crypto/objects”
make[2]: 对“all”无需做任何事。
make[2]: 离开目录“/opt/tool/nginx/openssl-1.0.1t/crypto/objects”
making all in crypto/md4...
make[2]: 进入目录“/opt/tool/nginx/openssl-1.0.1t/crypto/md4”
[root@localhost openssl-1.0.1t]# make install
making all in crypto...
make[1]: 进入目录“/opt/tool/nginx/openssl-1.0.1t/crypto”
making all in crypto/objects...
make[2]: 进入目录“/opt/tool/nginx/openssl-1.0.1t/crypto/objects”
make[2]: 对“all”无需做任何事。
make[2]: 离开目录“/opt/tool/nginx/openssl-1.0.1t/crypto/objects”
making all in crypto/md4...
make[2]: 进入目录“/opt/tool/nginx/openssl-1.0.1t/crypto/md4”
make[2]: 对“all”无需做任何事。
make[2]: 离开目录“/opt/tool/nginx/openssl-1.0.1t/crypto/md4”
making all in crypto/md5...
make[2]: 进入目录“/opt/tool/nginx/openssl-1.0.1t/crypto/md5”
make[2]: 对“all”无需做任何事。
make[2]: 离开目录“/opt/tool/nginx/openssl-1.0.1t/crypto/md5”
[root@localhost nginx]# tar -zxvf zlib-1.2.8.tar.gz
zlib-1.2.8/
zlib-1.2.8/adler32.c
zlib-1.2.8/amiga/
zlib-1.2.8/amiga/Makefile.pup
zlib-1.2.8/amiga/Makefile.sas
zlib-1.2.8/as400/
zlib-1.2.8/as400/bndsrc
zlib-1.2.8/as400/compile.clp
[root@localhost zlib-1.2.8]# ./configure
Checking for gcc...
Checking for shared library support...
Building shared library libz.so.1.2.8 with gcc.
Checking for off64_t... Yes.
Checking for fseeko... Yes.
Checking for strerror... Yes.
Checking for unistd.h... Yes.
Checking for stdarg.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for attribute(visibility) support... Yes.
[root@localhost zlib-1.2.8]# make
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o example.o test/example.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -c -o adler32.o adler32.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -c -o crc32.o crc32.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -c -o deflate.o deflate.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -c -o infback.o infback.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -c -o inffast.o inffast.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -c -o inflate.o inflate.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -c -o inftrees.o inftrees.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -c -o trees.o trees.c
[root@localhost zlib-1.2.8]# make install
cp libz.a /usr/local/lib
chmod 644 /usr/local/lib/libz.a
cp libz.so.1.2.8 /usr/local/lib
chmod 755 /usr/local/lib/libz.so.1.2.8
cp zlib.3 /usr/local/share/man/man3
chmod 644 /usr/local/share/man/man3/zlib.3
cp zlib.pc /usr/local/lib/pkgconfig
chmod 644 /usr/local/lib/pkgconfig/zlib.pc
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
[root@localhost zlib-1.2.8]# cd ..
[root@localhost nginx]# ls
nginx-1.20.1.tar.gz openssl-1.0.1t openssl-1.0.1t.tar.gz pcre-8.37 pcre-8.37.tar.gz zlib-1.2.8 zlib-1.2.8.tar.gz
[root@localhost nginx]#
[root@localhost nginx]# tar -zxvf nginx-1.20.1.tar.gz
nginx-1.20.1/
nginx-1.20.1/auto/
nginx-1.20.1/conf/
nginx-1.20.1/contrib/
nginx-1.20.1/src/
nginx-1.20.1/configure
nginx-1.20.1/LICENSE
nginx-1.20.1/README
[root@localhost nginx]# cd nginx-1.20.1/
[root@localhost nginx-1.20.1]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@localhost nginx-1.20.1]# ./configure
checking for OS
+ Linux 3.10.0-693.el7.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
[root@localhost nginx-1.20.1]# make
make -f objs/Makefile
make[1]: 进入目录“/opt/tool/nginx/nginx-1.20.1”
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/nginx.o \
src/core/nginx.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_log.o \
src/core/ngx_log.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
[root@localhost nginx-1.20.1]# make install
make -f objs/Makefile install
make[1]: 进入目录“/opt/tool/nginx/nginx-1.20.1”
test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
test -d '/usr/local/nginx/sbin' \
|| mkdir -p '/usr/local/nginx/sbin'
test ! -f '/usr/local/nginx/sbin/nginx' \
|| mv '/usr/local/nginx/sbin/nginx' \
'/usr/local/nginx/sbin/nginx.old'
cp objs/nginx '/usr/local/nginx/sbin/nginx'
test -d '/usr/local/nginx/conf' \
[root@localhost nginx-1.20.1]# pwd
/opt/tool/nginx/nginx-1.20.1
[root@localhost nginx-1.20.1]# cd /usr/local/nginx/
[root@localhost nginx]# pwd
/usr/local/nginx
[root@localhost nginx]# ls
conf html logs sbin
[root@localhost nginx-1.20.1]# cd /usr/local/nginx/
[root@localhost nginx]# pwd
/usr/local/nginx
[root@localhost nginx]# ls
conf html logs sbin
[root@localhost nginx]# cd sbin/
[root@localhost sbin]# ls
nginx
[root@localhost nginx-1.20.1]# cd /usr/local/nginx/
[root@localhost nginx]# pwd
/usr/local/nginx
[root@localhost nginx]# ls
conf html logs sbin
[root@localhost nginx]# cd sbin/
[root@localhost sbin]# ls
nginx
[root@localhost sbin]# pwd
/usr/local/nginx/sbin
[root@localhost sbin]# ./nginx
[root@localhost sbin]#
[root@localhost sbin]# ./nginx
[root@localhost sbin]# ./nginx -s stop
[root@localhost sbin]# ./nginx -s reload
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
[root@localhost sbin]# ./nginx -v
nginx version: nginx/1.20.1
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。