nginx笔记
模块分类
Nginx的模块化管理机制
高度模块化的设计保证了nginx的高可靠性,高可用性
高内聚(一个模块实现单一功能),低耦合(尽量减少模块之间的联系)的开发设计原则
模块结构图
模块体系结构
Nginx编译安装的配置参数
常用配置参数
实践编译nginx
[root@localhost ~]# ll
total 3652
-rw-------. 1 root root 1247 Apr 5 08:26 anaconda-ks.cfg
-rw-rw-rw-. 1 root root 1032630 Apr 7 22:05 nginx-1.16.1.tar.gz
-rw-rw-rw-. 1 root root 2085854 Apr 7 22:07 pcre-8.43.tar.gz
-rw-rw-rw-. 1 root root 607698 Apr 7 22:08 zlib-1.2.11.tar.gz
[root@localhost ~]# tar -xf nginx-1.16.1.tar.gz
[root@localhost ~]# tar -xf pcre-8.43.tar.gz
[root@localhost ~]# tar -xf zlib-1.2.11.tar.gz
[root@localhost ~]# ll
total 3668
-rw-------. 1 root root 1247 Apr 5 08:26 anaconda-ks.cfg
drwxr-xr-x. 8 1001 1001 158 Aug 13 2019 nginx-1.16.1
-rw-rw-rw-. 1 root root 1032630 Apr 7 22:05 nginx-1.16.1.tar.gz
drwxr-xr-x. 7 1169 1169 8192 Feb 23 2019 pcre-8.43
-rw-rw-rw-. 1 root root 2085854 Apr 7 22:07 pcre-8.43.tar.gz
drwxr-xr-x. 14 501 games 4096 Jan 15 2017 zlib-1.2.11
-rw-rw-rw-. 1 root root 607698 Apr 7 22:08 zlib-1.2.11.tar.gz
[root@localhost ~]# cd nginx-1.16.1
[root@localhost nginx-1.16.1]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@localhost nginx-1.16.1]# ./con
conf/ configure contrib/
[root@localhost nginx-1.16.1]# ./configure --help
--help print this message
--prefix=PATH set installation prefix
--sbin-path=PATH set nginx binary pathname
--modules-path=PATH set modules path
--conf-path=PATH set nginx.conf pathname
--error-log-path=PATH set error log pathname
--pid-path=PATH set nginx.pid pathname
--lock-path=PATH set nginx.lock pathname
--user=USER set non-privileged user for
worker processes
--group=GROUP set non-privileged group for
worker processes
--build=NAME set build name
--builddir=DIR set build directory
--with-select_module enable select module
--without-select_module disable select module
--with-poll_module enable poll module
--without-poll_module disable poll module
--with-threads enable thread pool support
--with-file-aio enable file AIO support
--with-http_ssl_module enable ngx_http_ssl_module
--with-http_v2_module enable ngx_http_v2_module
--with-http_realip_module enable ngx_http_realip_module
--with-http_addition_module enable ngx_http_addition_module
--with-http_xslt_module enable ngx_http_xslt_module
--with-http_xslt_module=dynamic enable dynamic ngx_http_xslt_module
--with-http_image_filter_module enable ngx_http_image_filter_module
--with-http_image_filter_module=dynamic
enable dynamic ngx_http_image_filter_module
--with-http_geoip_module enable ngx_http_geoip_module
--with-http_geoip_module=dynamic enable dynamic ngx_http_geoip_module
--with-http_sub_module enable ngx_http_sub_module
--with-http_dav_module enable ngx_http_dav_module
--with-http_flv_module enable ngx_http_flv_module
--with-http_mp4_module enable ngx_http_mp4_module
--with-http_gunzip_module enable ngx_http_gunzip_module
--with-http_gzip_static_module enable ngx_http_gzip_static_module
--with-http_auth_request_module enable ngx_http_auth_request_module
--with-http_random_index_module enable ngx_http_random_index_module
--with-http_secure_link_module enable ngx_http_secure_link_module
--with-http_degradation_module enable ngx_http_degradation_module
--with-http_slice_module enable ngx_http_slice_module
--with-http_stub_status_module enable ngx_http_stub_status_module
--without-http_charset_module disable ngx_http_charset_module
--without-http_gzip_module disable ngx_http_gzip_module
--without-http_ssi_module disable ngx_http_ssi_module
--without-http_userid_module disable ngx_http_userid_module
--without-http_access_module disable ngx_http_access_module
--without-http_auth_basic_module disable ngx_http_auth_basic_module
--without-http_mirror_module disable ngx_http_mirror_module
--without-http_autoindex_module disable ngx_http_autoindex_module
--without-http_geo_module disable ngx_http_geo_module
--without-http_map_module disable ngx_http_map_module
--without-http_split_clients_module disable ngx_http_split_clients_module
--without-http_referer_module disable ngx_http_referer_module
--without-http_rewrite_module disable ngx_http_rewrite_module
--without-http_proxy_module disable ngx_http_proxy_module
--without-http_fastcgi_module disable ngx_http_fastcgi_module
--without-http_uwsgi_module disable ngx_http_uwsgi_module
--without-http_scgi_module disable ngx_http_scgi_module
--without-http_grpc_module disable ngx_http_grpc_module
--without-http_memcached_module disable ngx_http_memcached_module
--without-http_limit_conn_module disable ngx_http_limit_conn_module
--without-http_limit_req_module disable ngx_http_limit_req_module
--without-http_empty_gif_module disable ngx_http_empty_gif_module
--without-http_browser_module disable ngx_http_browser_module
--without-http_upstream_hash_module
disable ngx_http_upstream_hash_module
--without-http_upstream_ip_hash_module
disable ngx_http_upstream_ip_hash_module
--without-http_upstream_least_conn_module
disable ngx_http_upstream_least_conn_module
--without-http_upstream_random_module
disable ngx_http_upstream_random_module
--without-http_upstream_keepalive_module
disable ngx_http_upstream_keepalive_module
--without-http_upstream_zone_module
disable ngx_http_upstream_zone_module
--with-http_perl_module enable ngx_http_perl_module
--with-http_perl_module=dynamic enable dynamic ngx_http_perl_module
--with-perl_modules_path=PATH set Perl modules path
--with-perl=PATH set perl binary pathname
--http-log-path=PATH set http access log pathname
--http-client-body-temp-path=PATH set path to store
http client request body temporary files
--http-proxy-temp-path=PATH set path to store
http proxy temporary files
--http-fastcgi-temp-path=PATH set path to store
http fastcgi temporary files
--http-uwsgi-temp-path=PATH set path to store
http uwsgi temporary files
--http-scgi-temp-path=PATH set path to store
http scgi temporary files
--without-http disable HTTP server
--without-http-cache disable HTTP cache
--with-mail enable POP3/IMAP4/SMTP proxy module
--with-mail=dynamic enable dynamic POP3/IMAP4/SMTP proxy module
--with-mail_ssl_module enable ngx_mail_ssl_module
--without-mail_pop3_module disable ngx_mail_pop3_module
--without-mail_imap_module disable ngx_mail_imap_module
--without-mail_smtp_module disable ngx_mail_smtp_module
--with-stream enable TCP/UDP proxy module
--with-stream=dynamic enable dynamic TCP/UDP proxy module
--with-stream_ssl_module enable ngx_stream_ssl_module
--with-stream_realip_module enable ngx_stream_realip_module
--with-stream_geoip_module enable ngx_stream_geoip_module
--with-stream_geoip_module=dynamic enable dynamic ngx_stream_geoip_module
--with-stream_ssl_preread_module enable ngx_stream_ssl_preread_module
--without-stream_limit_conn_module disable ngx_stream_limit_conn_module
--without-stream_access_module disable ngx_stream_access_module
--without-stream_geo_module disable ngx_stream_geo_module
--without-stream_map_module disable ngx_stream_map_module
--without-stream_split_clients_module
disable ngx_stream_split_clients_module
--without-stream_return_module disable ngx_stream_return_module
--without-stream_upstream_hash_module
disable ngx_stream_upstream_hash_module
--without-stream_upstream_least_conn_module
disable ngx_stream_upstream_least_conn_module
--without-stream_upstream_random_module
disable ngx_stream_upstream_random_module
--without-stream_upstream_zone_module
disable ngx_stream_upstream_zone_module
--with-google_perftools_module enable ngx_google_perftools_module
--with-cpp_test_module enable ngx_cpp_test_module
--add-module=PATH enable external module
--add-dynamic-module=PATH enable dynamic external module
--with-compat dynamic modules compatibility
--with-cc=PATH set C compiler pathname
--with-cpp=PATH set C preprocessor pathname
--with-cc-opt=OPTIONS set additional C compiler options
--with-ld-opt=OPTIONS set additional linker options
--with-cpu-opt=CPU build for the specified CPU, valid values:
pentium, pentiumpro, pentium3, pentium4,
athlon, opteron, sparc32, sparc64, ppc64
--without-pcre disable PCRE library usage
--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-zlib=DIR set path to zlib library sources
--with-zlib-opt=OPTIONS set additional build options for zlib
--with-zlib-asm=CPU use zlib assembler sources optimized
for the specified CPU, valid values:
pentium, pentiumpro
--with-libatomic force libatomic_ops library usage
--with-libatomic=DIR set path to libatomic_ops library sources
--with-openssl=DIR set path to OpenSSL library sources
--with-openssl-opt=OPTIONS set additional build options for OpenSSL
--with-debug enable debug logging
[root@localhost nginx-1.16.1]#
[root@localhost nginx-1.16.1]# ./configure --prefix=/opt/nginx --conf-path=/opt/nginx/conf/nginx.conf --user=nginx --group=nginx --pid-path=/opt/nginx/pid/nginx.pid --error-log-path=/opt/nginx/logs/error.log --with-pcre=/root/pcre-8.43 --with-zlib=/root/zlib-1.2.11 --with-http_ssl_module --with-http_v2_module
checking for OS
+ Linux 3.10.0-1160.el7.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found
[root@localhost nginx-1.16.1]# yum install gcc gcc-c++ -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-44.el7 will be installed
--> Processing Dependency: cpp = 4.8.5-44.el7 for package: gcc-4.8.5-44.el7.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-44.el7.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-44.el7.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-44.el7.x86_64
---> Package gcc-c++.x86_64 0:4.8.5-44.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-44.el7 for package: gcc-c++-4.8.5-44.el7.x86_64
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-44.el7 will be installed
---> Package glibc-devel.x86_64 0:2.17-326.el7_9 will be installed
--> Processing Dependency: glibc-headers = 2.17-326.el7_9 for package: glibc-devel-2.17-326.el7_9.x86_64
--> Processing Dependency: glibc = 2.17-326.el7_9 for package: glibc-devel-2.17-326.el7_9.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-326.el7_9.x86_64
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-44.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
--> Running transaction check
---> Package glibc.x86_64 0:2.17-317.el7 will be updated
--> Processing Dependency: glibc = 2.17-317.el7 for package: glibc-common-2.17-317.el7.x86_64
---> Package glibc.x86_64 0:2.17-326.el7_9 will be an update
---> Package glibc-headers.x86_64 0:2.17-326.el7_9 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-326.el7_9.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-326.el7_9.x86_64
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-317.el7 will be updated
---> Package glibc-common.x86_64 0:2.17-326.el7_9 will be an update
---> Package kernel-headers.x86_64 0:3.10.0-1160.88.1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================
Package Arch Version Repository
Size
==================================================================
Installing:
gcc x86_64 4.8.5-44.el7 base 16 M
gcc-c++ x86_64 4.8.5-44.el7 base 7.2 M
Installing for dependencies:
cpp x86_64 4.8.5-44.el7 base 5.9 M
glibc-devel x86_64 2.17-326.el7_9 updates 1.1 M
glibc-headers x86_64 2.17-326.el7_9 updates 691 k
kernel-headers x86_64 3.10.0-1160.88.1.el7 updates 9.1 M
libmpc x86_64 1.0.1-3.el7 base 51 k
libstdc++-devel x86_64 4.8.5-44.el7 base 1.5 M
mpfr x86_64 3.1.1-4.el7 base 203 k
Updating for dependencies:
glibc x86_64 2.17-326.el7_9 updates 3.6 M
glibc-common x86_64 2.17-326.el7_9 updates 12 M
Transaction Summary
==================================================================
Install 2 Packages (+7 Dependent packages)
Upgrade ( 2 Dependent packages)
Total download size: 57 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/11): glibc-2.17-326.el7_9.x86_64.rpm | 3.6 MB 00:01
(2/11): glibc-devel-2.17-326.el7_9.x86_64.rp | 1.1 MB 00:00
(3/11): glibc-headers-2.17-326.el7_9.x86_64. | 691 kB 00:00
(4/11): cpp-4.8.5-44.el7.x86_64.rpm | 5.9 MB 00:02
(5/11): libmpc-1.0.1-3.el7.x86_64.rpm | 51 kB 00:00
(6/11): kernel-headers-3.10.0-1160.88.1.el7. | 9.1 MB 00:01
(7/11): libstdc++-devel-4.8.5-44.el7.x86_64. | 1.5 MB 00:00
(8/11): mpfr-3.1.1-4.el7.x86_64.rpm | 203 kB 00:00
(9/11): gcc-4.8.5-44.el7.x86_64.rpm | 16 MB 00:04
(10/11): gcc-c++-4.8.5-44.el7.x86_64.rpm | 7.2 MB 00:06
(11/11): glibc-common-2.17-326.el7_9.x86_64. | 12 MB 00:16
------------------------------------------------------------------
Total 3.4 MB/s | 57 MB 00:16
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : glibc-2.17-326.el7_9.x86_64 1/13
Updating : glibc-common-2.17-326.el7_9.x86_64 2/13
Installing : mpfr-3.1.1-4.el7.x86_64 3/13
Installing : libmpc-1.0.1-3.el7.x86_64 4/13
Installing : cpp-4.8.5-44.el7.x86_64 5/13
Installing : kernel-headers-3.10.0-1160.88.1.el7.x86_64 6/13
Installing : glibc-headers-2.17-326.el7_9.x86_64 7/13
Installing : glibc-devel-2.17-326.el7_9.x86_64 8/13
Installing : gcc-4.8.5-44.el7.x86_64 9/13
Installing : libstdc++-devel-4.8.5-44.el7.x86_64 10/13
Installing : gcc-c++-4.8.5-44.el7.x86_64 11/13
Cleanup : glibc-2.17-317.el7.x86_64 12/13
Cleanup : glibc-common-2.17-317.el7.x86_64 13/13
Verifying : gcc-c++-4.8.5-44.el7.x86_64 1/13
Verifying : glibc-common-2.17-326.el7_9.x86_64 2/13
Verifying : glibc-2.17-326.el7_9.x86_64 3/13
Verifying : mpfr-3.1.1-4.el7.x86_64 4/13
Verifying : glibc-devel-2.17-326.el7_9.x86_64 5/13
Verifying : cpp-4.8.5-44.el7.x86_64 6/13
Verifying : glibc-headers-2.17-326.el7_9.x86_64 7/13
Verifying : gcc-4.8.5-44.el7.x86_64 8/13
Verifying : libstdc++-devel-4.8.5-44.el7.x86_64 9/13
Verifying : libmpc-1.0.1-3.el7.x86_64 10/13
Verifying : kernel-headers-3.10.0-1160.88.1.el7.x86_64 11/13
Verifying : glibc-2.17-317.el7.x86_64 12/13
Verifying : glibc-common-2.17-317.el7.x86_64 13/13
Installed:
gcc.x86_64 0:4.8.5-44.el7 gcc-c++.x86_64 0:4.8.5-44.el7
Dependency Installed:
cpp.x86_64 0:4.8.5-44.el7
glibc-devel.x86_64 0:2.17-326.el7_9
glibc-headers.x86_64 0:2.17-326.el7_9
kernel-headers.x86_64 0:3.10.0-1160.88.1.el7
libmpc.x86_64 0:1.0.1-3.el7
libstdc++-devel.x86_64 0:4.8.5-44.el7
mpfr.x86_64 0:3.1.1-4.el7
Dependency Updated:
glibc.x86_64 0:2.17-326.el7_9
glibc-common.x86_64 0:2.17-326.el7_9
Complete!
[root@localhost nginx-1.16.1]#
[root@localhost nginx-1.16.1]# ./configure --prefix=/opt/nginx --conf-path=/opt/nginx/conf/nginx.conf --user=nginx --group=nginx --pid-path=/opt/nginx/pid/nginx.pid --error-log-path=/opt/nginx/logs/error.log --with-pcre=/root/pcre-8.43 --with-zlib=/root/zlib-1.2.11 --with-http_ssl_module --with-http_v2_module
checking for OS
+ Linux 3.10.0-1160.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
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for EPOLLRDHUP ... found
checking for EPOLLEXCLUSIVE ... not found
checking for O_PATH ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for prctl(PR_SET_KEEPCAPS) ... found
checking for capabilities ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for sched_setaffinity() ... found
checking for SO_SETFIB ... not found
checking for SO_REUSEPORT ... found
checking for SO_ACCEPTFILTER ... not found
checking for SO_BINDANY ... not found
checking for IP_TRANSPARENT ... found
checking for IP_BINDANY ... not found
checking for IP_BIND_ADDRESS_NO_PORT ... found
checking for IP_RECVDSTADDR ... not found
checking for IP_SENDSRCADDR ... not found
checking for IP_PKTINFO ... found
checking for IPV6_RECVPKTINFO ... found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE ... found
checking for TCP_FASTOPEN ... found
checking for TCP_INFO ... found
checking for accept4() ... found
checking for eventfd() ... found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint32_t ... found
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for pwritev() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for clock_gettime(CLOCK_MONOTONIC) ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for OpenSSL library ... not found
checking for OpenSSL library in /usr/local/ ... not found
checking for OpenSSL library in /usr/pkg/ ... not found
checking for OpenSSL library in /opt/local/ ... not found
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
[root@localhost nginx-1.16.1]# yum -y install openssl openssl-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package openssl.x86_64 1:1.0.2k-19.el7 will be updated
---> Package openssl.x86_64 1:1.0.2k-26.el7_9 will be an update
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-26.el7_9 for package: 1:openssl-1.0.2k-26.el7_9.x86_64
---> Package openssl-devel.x86_64 1:1.0.2k-26.el7_9 will be installed
--> Processing Dependency: zlib-devel(x86-64) for package: 1:openssl-devel-1.0.2k-26.el7_9.x86_64
--> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.2k-26.el7_9.x86_64
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.15.1-55.el7_9 will be installed
--> Processing Dependency: libkadm5(x86-64) = 1.15.1-55.el7_9 for package: krb5-devel-1.15.1-55.el7_9.x86_64
--> Processing Dependency: krb5-libs(x86-64) = 1.15.1-55.el7_9 for package: krb5-devel-1.15.1-55.el7_9.x86_64
--> Processing Dependency: libverto-devel for package: krb5-devel-1.15.1-55.el7_9.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.15.1-55.el7_9.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.15.1-55.el7_9.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.15.1-55.el7_9.x86_64
---> Package openssl-libs.x86_64 1:1.0.2k-19.el7 will be updated
---> Package openssl-libs.x86_64 1:1.0.2k-26.el7_9 will be an update
---> Package zlib-devel.x86_64 0:1.2.7-21.el7_9 will be installed
--> Processing Dependency: zlib = 1.2.7-21.el7_9 for package: zlib-devel-1.2.7-21.el7_9.x86_64
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed
---> Package krb5-libs.x86_64 0:1.15.1-50.el7 will be updated
---> Package krb5-libs.x86_64 0:1.15.1-55.el7_9 will be an update
---> Package libcom_err-devel.x86_64 0:1.42.9-19.el7 will be installed
---> Package libkadm5.x86_64 0:1.15.1-55.el7_9 will be installed
---> Package libselinux-devel.x86_64 0:2.5-15.el7 will be installed
--> Processing Dependency: libsepol-devel(x86-64) >= 2.5-10 for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: pkgconfig(libpcre) for package: libselinux-devel-2.5-15.el7.x86_64
---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed
---> Package zlib.x86_64 0:1.2.7-18.el7 will be updated
---> Package zlib.x86_64 0:1.2.7-21.el7_9 will be an update
--> Running transaction check
---> Package libsepol-devel.x86_64 0:2.5-10.el7 will be installed
---> Package pcre-devel.x86_64 0:8.32-17.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================
Package Arch Version Repository
Size
==================================================================
Installing:
openssl-devel x86_64 1:1.0.2k-26.el7_9 updates 1.5 M
Updating:
openssl x86_64 1:1.0.2k-26.el7_9 updates 494 k
Installing for dependencies:
keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k
krb5-devel x86_64 1.15.1-55.el7_9 updates 273 k
libcom_err-devel x86_64 1.42.9-19.el7 base 32 k
libkadm5 x86_64 1.15.1-55.el7_9 updates 180 k
libselinux-devel x86_64 2.5-15.el7 base 187 k
libsepol-devel x86_64 2.5-10.el7 base 77 k
libverto-devel x86_64 0.2.5-4.el7 base 12 k
pcre-devel x86_64 8.32-17.el7 base 480 k
zlib-devel x86_64 1.2.7-21.el7_9 updates 50 k
Updating for dependencies:
krb5-libs x86_64 1.15.1-55.el7_9 updates 810 k
openssl-libs x86_64 1:1.0.2k-26.el7_9 updates 1.2 M
zlib x86_64 1.2.7-21.el7_9 updates 90 k
Transaction Summary
==================================================================
Install 1 Package (+9 Dependent packages)
Upgrade 1 Package (+3 Dependent packages)
Total download size: 5.4 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/14): keyutils-libs-devel-1.5.8-3.el7.x86_ | 37 kB 00:00
(2/14): krb5-devel-1.15.1-55.el7_9.x86_64.rp | 273 kB 00:00
(3/14): libselinux-devel-2.5-15.el7.x86_64.r | 187 kB 00:00
(4/14): libcom_err-devel-1.42.9-19.el7.x86_6 | 32 kB 00:00
(5/14): libverto-devel-0.2.5-4.el7.x86_64.rp | 12 kB 00:00
(6/14): libkadm5-1.15.1-55.el7_9.x86_64.rpm | 180 kB 00:00
(7/14): libsepol-devel-2.5-10.el7.x86_64.rpm | 77 kB 00:00
(8/14): openssl-1.0.2k-26.el7_9.x86_64.rpm | 494 kB 00:00
(9/14): krb5-libs-1.15.1-55.el7_9.x86_64.rpm | 810 kB 00:00
(10/14): zlib-1.2.7-21.el7_9.x86_64.rpm | 90 kB 00:00
(11/14): zlib-devel-1.2.7-21.el7_9.x86_64.rp | 50 kB 00:00
(12/14): openssl-devel-1.0.2k-26.el7_9.x86_6 | 1.5 MB 00:00
(13/14): pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:00
(14/14): openssl-libs-1.0.2k-26.el7_9.x86_64 | 1.2 MB 00:01
------------------------------------------------------------------
Total 3.6 MB/s | 5.4 MB 00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : zlib-1.2.7-21.el7_9.x86_64 1/18
Updating : 1:openssl-libs-1.0.2k-26.el7_9.x86_64 2/18
Updating : krb5-libs-1.15.1-55.el7_9.x86_64 3/18
Installing : libkadm5-1.15.1-55.el7_9.x86_64 4/18
Installing : zlib-devel-1.2.7-21.el7_9.x86_64 5/18
Installing : libcom_err-devel-1.42.9-19.el7.x86_64 6/18
Installing : pcre-devel-8.32-17.el7.x86_64 7/18
Installing : libsepol-devel-2.5-10.el7.x86_64 8/18
Installing : libselinux-devel-2.5-15.el7.x86_64 9/18
Installing : libverto-devel-0.2.5-4.el7.x86_64 10/18
Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64 11/18
Installing : krb5-devel-1.15.1-55.el7_9.x86_64 12/18
Installing : 1:openssl-devel-1.0.2k-26.el7_9.x86_64 13/18
Updating : 1:openssl-1.0.2k-26.el7_9.x86_64 14/18
Cleanup : 1:openssl-1.0.2k-19.el7.x86_64 15/18
Cleanup : 1:openssl-libs-1.0.2k-19.el7.x86_64 16/18
Cleanup : krb5-libs-1.15.1-50.el7.x86_64 17/18
Cleanup : zlib-1.2.7-18.el7.x86_64 18/18
Verifying : 1:openssl-devel-1.0.2k-26.el7_9.x86_64 1/18
Verifying : zlib-devel-1.2.7-21.el7_9.x86_64 2/18
Verifying : keyutils-libs-devel-1.5.8-3.el7.x86_64 3/18
Verifying : libverto-devel-0.2.5-4.el7.x86_64 4/18
Verifying : libkadm5-1.15.1-55.el7_9.x86_64 5/18
Verifying : krb5-libs-1.15.1-55.el7_9.x86_64 6/18
Verifying : 1:openssl-libs-1.0.2k-26.el7_9.x86_64 7/18
Verifying : krb5-devel-1.15.1-55.el7_9.x86_64 8/18
Verifying : libsepol-devel-2.5-10.el7.x86_64 9/18
Verifying : pcre-devel-8.32-17.el7.x86_64 10/18
Verifying : libselinux-devel-2.5-15.el7.x86_64 11/18
Verifying : libcom_err-devel-1.42.9-19.el7.x86_64 12/18
Verifying : zlib-1.2.7-21.el7_9.x86_64 13/18
Verifying : 1:openssl-1.0.2k-26.el7_9.x86_64 14/18
Verifying : zlib-1.2.7-18.el7.x86_64 15/18
Verifying : 1:openssl-1.0.2k-19.el7.x86_64 16/18
Verifying : krb5-libs-1.15.1-50.el7.x86_64 17/18
Verifying : 1:openssl-libs-1.0.2k-19.el7.x86_64 18/18
Installed:
openssl-devel.x86_64 1:1.0.2k-26.el7_9
Dependency Installed:
keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-55.el7_9
libcom_err-devel.x86_64 0:1.42.9-19.el7 libkadm5.x86_64 0:1.15.1-55.el7_9
libselinux-devel.x86_64 0:2.5-15.el7 libsepol-devel.x86_64 0:2.5-10.el7
libverto-devel.x86_64 0:0.2.5-4.el7 pcre-devel.x86_64 0:8.32-17.el7
zlib-devel.x86_64 0:1.2.7-21.el7_9
Updated:
openssl.x86_64 1:1.0.2k-26.el7_9
Dependency Updated:
krb5-libs.x86_64 0:1.15.1-55.el7_9 openssl-libs.x86_64 1:1.0.2k-26.el7_9
zlib.x86_64 0:1.2.7-21.el7_9
Complete!
[root@localhost nginx-1.16.1]#
[root@localhost nginx-1.16.1]# ./configure --prefix=/opt/nginx --conf-path=/opt/nginx/conf/nginx.conf --user=nginx --group=nginx --pid-path=/opt/nginx/pid/nginx.pid --error-log-path=/opt/nginx/logs/error.log --with-pcre=/root/pcre-8.43 --with-zlib=/root/zlib-1.2.11 --with-http_ssl_module --with-http_v2_module
checking for OS
+ Linux 3.10.0-1160.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
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for EPOLLRDHUP ... found
checking for EPOLLEXCLUSIVE ... not found
checking for O_PATH ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for prctl(PR_SET_KEEPCAPS) ... found
checking for capabilities ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for sched_setaffinity() ... found
checking for SO_SETFIB ... not found
checking for SO_REUSEPORT ... found
checking for SO_ACCEPTFILTER ... not found
checking for SO_BINDANY ... not found
checking for IP_TRANSPARENT ... found
checking for IP_BINDANY ... not found
checking for IP_BIND_ADDRESS_NO_PORT ... found
checking for IP_RECVDSTADDR ... not found
checking for IP_SENDSRCADDR ... not found
checking for IP_PKTINFO ... found
checking for IPV6_RECVPKTINFO ... found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE ... found
checking for TCP_FASTOPEN ... found
checking for TCP_INFO ... found
checking for accept4() ... found
checking for eventfd() ... found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint32_t ... found
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for pwritev() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for clock_gettime(CLOCK_MONOTONIC) ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for OpenSSL library ... found
creating objs/Makefile
Configuration summary
+ using PCRE library: /root/pcre-8.43
+ using system OpenSSL library
+ using zlib library: /root/zlib-1.2.11
nginx path prefix: "/opt/nginx"
nginx binary file: "/opt/nginx/sbin/nginx"
nginx modules path: "/opt/nginx/modules"
nginx configuration prefix: "/opt/nginx/conf"
nginx configuration file: "/opt/nginx/conf/nginx.conf"
nginx pid file: "/opt/nginx/pid/nginx.pid"
nginx error log file: "/opt/nginx/logs/error.log"
nginx http access log file: "/opt/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
[root@localhost nginx-1.16.1]# make && make install
。。。
|| cp conf/nginx.conf '/opt/nginx/conf/nginx.conf'
cp conf/nginx.conf '/opt/nginx/conf/nginx.conf.default'
test -d '/opt/nginx/pid' \
|| mkdir -p '/opt/nginx/pid'
test -d '/opt/nginx/logs' \
|| mkdir -p '/opt/nginx/logs'
test -d '/opt/nginx/html' \
|| cp -R html '/opt/nginx'
test -d '/opt/nginx/logs' \
|| mkdir -p '/opt/nginx/logs'
make[1]: Leaving directory `/root/nginx-1.16.1'
[root@localhost nginx-1.16.1]#
[root@localhost ~]# cd /opt/nginx/
[root@localhost nginx]# tree
.
├── conf
│ ├── fastcgi.conf
│ ├── fastcgi.conf.default
│ ├── fastcgi_params
│ ├── fastcgi_params.default
│ ├── koi-utf
│ ├── koi-win
│ ├── mime.types
│ ├── mime.types.default
│ ├── nginx.conf
│ ├── nginx.conf.default
│ ├── scgi_params
│ ├── scgi_params.default
│ ├── uwsgi_params
│ ├── uwsgi_params.default
│ └── win-utf
├── html
│ ├── 50x.html
│ └── index.html
├── logs
├── pid
└── sbin
└── nginx
5 directories, 18 files
[root@localhost nginx]#
[root@localhost conf]# /opt/nginx/sbin/nginx
[root@localhost conf]# ps -ef | grep nginx
root 1677 1 0 19:54 ? 00:00:00 nginx: master process /usr/sbin/nginx
nginx 1746 1677 0 20:05 ? 00:00:00 nginx: worker process
nginx 1747 1677 0 20:05 ? 00:00:00 nginx: worker process
nginx 1748 1677 0 20:05 ? 00:00:00 nginx: worker process
nginx 1749 1677 0 20:05 ? 00:00:00 nginx: worker process
nginx 1750 1677 0 20:05 ? 00:00:00 nginx: worker process
nginx 1751 1677 0 20:05 ? 00:00:00 nginx: worker process
root 12856 2579 0 22:40 pts/0 00:00:00 grep --color=auto nginx
访问成功
# 检查语法
[root@localhost logs]# /opt/nginx/sbin/nginx -t
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful