Nginx常见的安装方式
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.Nginx概述
Nginx的安装版本分为开发版、稳定版和过期版, Nginx安装可以使用yum或源码安装,但是推荐使用源码安装,原因如下: 1>.是yum的版本比较旧; 2>.是编译安装可以更方便自定义相关路径; 3>.是使用源码编译可以自定义相关功能,更方便业务的上的使用。 源码安装需要提前准备以下环境: 标准的编译器,GCC的全称是(GNU Compiler collection),其有GNU开发,并以GPL即LGPL许可,是自由的类UNIX即苹果电脑Mac OS X操作系统的标准编译器,因为GCC原本只能处理C语言,所以原名为GNU C语言编译器,后来得到快速发展,可以处理C++,Fortran,pascal,objective-C,java以及Ada等其他语言 此外还需要Automake工具,以完成自动创建Makefile的工作
Nginx的一些模块需要依赖第三方库,比如pcre(支持rewrite),zlib(支持gzip模块)和openssl(支持ssl模块)等。
二.yum方式安装nginx(生产环境中进来不要使用yum方式安装nginx,尽管它的安装方式很简单)
1>.查看nginx官网提供的安装包
2>.如下图所示,选择相应的操作系统
3>.查看CentOS基于yum方式安装nginx的官网文档(http://nginx.org/en/linux_packages.html#RHEL-CentOS)
4>.根据官方文档基于yum方式安装nginx实战
[[email protected] ~]# yum -y install yum-utils Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.bit.edu.cn * epel: hk.mirrors.thegigabit.com * extras: mirror.jdcloud.com * updates: mirror.bit.edu.cn Resolving Dependencies --> Running transaction check ---> Package yum-utils.noarch 0:1.1.31-52.el7 will be installed --> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-52.el7.noarch --> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-52.el7.noarch --> Running transaction check ---> Package libxml2-python.x86_64 0:2.9.1-6.el7_2.3 will be installed ---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed --> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch --> Running transaction check ---> Package python-chardet.noarch 0:2.2.1-3.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: yum-utils noarch 1.1.31-52.el7 base 121 k Installing for dependencies: libxml2-python x86_64 2.9.1-6.el7_2.3 base 247 k python-chardet noarch 2.2.1-3.el7 base 227 k python-kitchen noarch 1.1.1-5.el7 base 267 k Transaction Summary ============================================================================================================================================================================ Install 1 Package (+3 Dependent packages) Total download size: 862 k Installed size: 4.3 M Downloading packages: (1/4): python-chardet-2.2.1-3.el7.noarch.rpm | 227 kB 00:00:00 (2/4): libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm | 247 kB 00:00:00 (3/4): yum-utils-1.1.31-52.el7.noarch.rpm | 121 kB 00:00:00 (4/4): python-kitchen-1.1.1-5.el7.noarch.rpm | 267 kB 00:00:00 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 1.9 MB/s | 862 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python-chardet-2.2.1-3.el7.noarch 1/4 Installing : python-kitchen-1.1.1-5.el7.noarch 2/4 Installing : libxml2-python-2.9.1-6.el7_2.3.x86_64 3/4 Installing : yum-utils-1.1.31-52.el7.noarch 4/4 Verifying : python-kitchen-1.1.1-5.el7.noarch 1/4 Verifying : yum-utils-1.1.31-52.el7.noarch 2/4 Verifying : libxml2-python-2.9.1-6.el7_2.3.x86_64 3/4 Verifying : python-chardet-2.2.1-3.el7.noarch 4/4 Installed: yum-utils.noarch 0:1.1.31-52.el7 Dependency Installed: libxml2-python.x86_64 0:2.9.1-6.el7_2.3 python-chardet.noarch 0:2.2.1-3.el7 python-kitchen.noarch 0:1.1.1-5.el7 Complete! [[email protected] ~]#
[[email protected] ~]# vim /etc/yum.repos.d/nginx.repo #手动创建nginx.repo文件 [[email protected] ~]# [[email protected] ~]# cat /etc/yum.repos.d/nginx.repo [nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true [[email protected] ~]# [[email protected] ~]# yum list nginx #可以确认咱们的配置生效了 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.bit.edu.cn * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.com Available Packages nginx.x86_64 1:1.16.1-1.el7.ngx nginx-stable [[email protected] ~]#
[[email protected] ~]# yum list nginx* Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.bit.edu.cn * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.com Available Packages nginx.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-all-modules.noarch 1:1.16.1-1.el7 epel nginx-debug.x86_64 1:1.8.0-1.el7.ngx nginx-stable nginx-debuginfo.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-filesystem.noarch 1:1.16.1-1.el7 epel nginx-mod-http-image-filter.x86_64 1:1.16.1-1.el7 epel nginx-mod-http-perl.x86_64 1:1.16.1-1.el7 epel nginx-mod-http-xslt-filter.x86_64 1:1.16.1-1.el7 epel nginx-mod-mail.x86_64 1:1.16.1-1.el7 epel nginx-mod-stream.x86_64 1:1.16.1-1.el7 epel nginx-module-geoip.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-module-geoip-debuginfo.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-module-image-filter.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-module-image-filter-debuginfo.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-module-njs.x86_64 1:1.16.1.0.3.7-1.el7.ngx nginx-stable nginx-module-njs-debuginfo.x86_64 1:1.16.1.0.3.7-1.el7.ngx nginx-stable nginx-module-perl.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-module-perl-debuginfo.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-module-xslt.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-module-xslt-debuginfo.x86_64 1:1.16.1-1.el7.ngx nginx-stable nginx-nr-agent.noarch 2.0.0-12.el7.ngx nginx-stable [[email protected] ~]#
[[email protected] ~]# yum -y install nginx Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.bit.edu.cn * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.com Resolving Dependencies --> Running transaction check ---> Package nginx.x86_64 1:1.16.1-1.el7.ngx will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: nginx x86_64 1:1.16.1-1.el7.ngx nginx-stable 766 k Transaction Summary ============================================================================================================================================================================ Install 1 Package Total download size: 766 k Installed size: 2.7 M Downloading packages: warning: /var/cache/yum/x86_64/7/nginx-stable/packages/nginx-1.16.1-1.el7.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY1 kB/s | 766 kB 00:00:00 ETA Public key for nginx-1.16.1-1.el7.ngx.x86_64.rpm is not installed nginx-1.16.1-1.el7.ngx.x86_64.rpm | 766 kB 00:01:06 Retrieving key from https://nginx.org/keys/nginx_signing.key Importing GPG key 0x7BD9BF62: Userid : "nginx signing key" Fingerprint: 573b fd6b 3d8f bc64 1079 a6ab abf5 bd82 7bd9 bf62 From : https://nginx.org/keys/nginx_signing.key Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:nginx-1.16.1-1.el7.ngx.x86_64 1/1 ---------------------------------------------------------------------- Thanks for using nginx! Please find the official documentation for nginx here: * http://nginx.org/en/docs/ Please subscribe to nginx-announce mailing list to get the most important news about nginx: * http://nginx.org/en/support.html Commercial subscriptions for nginx are available on: * http://nginx.com/products/ ---------------------------------------------------------------------- Verifying : 1:nginx-1.16.1-1.el7.ngx.x86_64 1/1 Installed: nginx.x86_64 1:1.16.1-1.el7.ngx Complete! [[email protected] ~]#
[[email protected] ~]# rpm -ql nginx /etc/logrotate.d/nginx /etc/nginx /etc/nginx/conf.d /etc/nginx/conf.d/default.conf /etc/nginx/fastcgi_params /etc/nginx/koi-utf /etc/nginx/koi-win /etc/nginx/mime.types /etc/nginx/modules /etc/nginx/nginx.conf /etc/nginx/scgi_params /etc/nginx/uwsgi_params /etc/nginx/win-utf /etc/sysconfig/nginx /etc/sysconfig/nginx-debug /usr/lib/systemd/system/nginx-debug.service /usr/lib/systemd/system/nginx.service /usr/lib64/nginx /usr/lib64/nginx/modules /usr/libexec/initscripts/legacy-actions/nginx /usr/libexec/initscripts/legacy-actions/nginx/check-reload /usr/libexec/initscripts/legacy-actions/nginx/upgrade /usr/sbin/nginx /usr/sbin/nginx-debug /usr/share/doc/nginx-1.16.1 /usr/share/doc/nginx-1.16.1/COPYRIGHT /usr/share/man/man8/nginx.8.gz /usr/share/nginx /usr/share/nginx/html /usr/share/nginx/html/50x.html /usr/share/nginx/html/index.html /var/cache/nginx /var/log/nginx [[email protected] ~]#
[[email protected] ~]# rpm -qi nginx Name : nginx Epoch : 1 Version : 1.16.1 Release : 1.el7.ngx Architecture: x86_64 Install Date: Sun 15 Dec 2019 11:07:59 AM CST Group : System Environment/Daemons Size : 2811768 License : 2-clause BSD-like license Signature : RSA/SHA1, Wed 14 Aug 2019 12:16:59 AM CST, Key ID abf5bd827bd9bf62 Source RPM : nginx-1.16.1-1.el7.ngx.src.rpm Build Date : Tue 13 Aug 2019 11:04:33 PM CST Build Host : centos74-amd64-builder-builder.gnt.nginx.com Relocations : (not relocatable) Vendor : Nginx, Inc. URL : http://nginx.org/ Summary : High performance web server Description : nginx [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server. [[email protected] ~]#
[[email protected] ~]# cat /usr/lib/systemd/system/nginx.service [Unit] Description=nginx - high performance web server Documentation=http://nginx.org/en/docs/ After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/var/run/nginx.pid ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID [Install] WantedBy=multi-user.target [[email protected] ~]# [[email protected] ~]#
[[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# systemctl start nginx #启动nginx服务 [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# ps -ef | grep nginx root 4225 1 0 12:06 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf nginx 4226 4225 0 12:06 ? 00:00:00 nginx: worker process root 4260 3535 0 13:21 pts/0 00:00:00 grep --color=auto nginx [[email protected] ~]#
5>.基于epel源安装nginx
[[email protected] ~]# yum -y install epel-release Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirror.jdcloud.com * updates: mirrors.tuna.tsinghua.edu.cn Resolving Dependencies --> Running transaction check ---> Package epel-release.noarch 0:7-11 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: epel-release noarch 7-11 extras 15 k Transaction Summary ============================================================================================================================================================================ Install 1 Package Total download size: 15 k Installed size: 24 k Downloading packages: epel-release-7-11.noarch.rpm | 15 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : epel-release-7-11.noarch 1/1 Verifying : epel-release-7-11.noarch 1/1 Installed: epel-release.noarch 0:7-11 Complete! [[email protected] ~]# [[email protected] ~]#
[[email protected] ~]# yum list nginx Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel/x86_64/metalink | 7.6 kB 00:00:00 * base: mirrors.tuna.tsinghua.edu.cn * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirror.jdcloud.com * updates: mirrors.tuna.tsinghua.edu.cn epel | 5.3 kB 00:00:00 (1/3): epel/x86_64/group_gz | 90 kB 00:00:00 (2/3): epel/x86_64/updateinfo | 1.0 MB 00:00:01 (3/3): epel/x86_64/primary_db | 6.9 MB 00:00:04 Available Packages nginx.x86_64 1:1.16.1-1.el7 epel [[email protected] ~]#
三.编译方式安装nginx
1>.下载nginx长期支持版本
博主推荐阅读: https://nginx.org/en/download.html
2>.如上图所示,将下载的软件上传到服务器进行后续的安装操作,如果服务器有网络的情况下,也可以直接在互联网下载
[[email protected] ~]# yum -y install wget Loaded plugins: fastestmirror Determining fastest mirrors * base: mirror.bit.edu.cn * extras: mirror.bit.edu.cn * updates: mirrors.huaweicloud.com base | 3.6 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/4): base/7/x86_64/group_gz | 165 kB 00:00:00 (2/4): extras/7/x86_64/primary_db | 153 kB 00:00:00 (3/4): base/7/x86_64/primary_db | 6.0 MB 00:00:01 (4/4): updates/7/x86_64/primary_db | 5.8 MB 00:00:01 Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: wget x86_64 1.14-18.el7_6.1 base 547 k Transaction Summary ============================================================================================================================================================================ Install 1 Package Total download size: 547 k Installed size: 2.0 M Downloading packages: wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : wget-1.14-18.el7_6.1.x86_64 1/1 Verifying : wget-1.14-18.el7_6.1.x86_64 1/1 Installed: wget.x86_64 0:1.14-18.el7_6.1 Complete! [[email protected] ~]#
[[email protected] ~]# cd /usr/local/src/ [[email protected] /usr/local/src]# [[email protected] /usr/local/src]# [[email protected] /usr/local/src]# wget https://nginx.org/download/nginx-1.14.2.tar.gz --2019-12-15 13:27:15-- https://nginx.org/download/nginx-1.14.2.tar.gz Resolving nginx.org (nginx.org)... 95.211.80.227, 62.210.92.35, 2001:1af8:4060:a004:21::e3 Connecting to nginx.org (nginx.org)|95.211.80.227|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1015384 (992K) [application/octet-stream] Saving to: ‘nginx-1.14.2.tar.gz’ 100%[==================================================================================================================================>] 1,015,384 16.5KB/s in 85s 2019-12-15 13:28:44 (11.7 KB/s) - ‘nginx-1.14.2.tar.gz’ saved [1015384/1015384] [[email protected] /usr/local/src]#
3>.解压nginx文件
[[email protected] /usr/local/src]# ll total 992 -rw-r--r-- 1 root root 1015384 Dec 4 2018 nginx-1.14.2.tar.gz [[email protected] /usr/local/src]# [[email protected] /usr/local/src]# tar -xf nginx-1.14.2.tar.gz [[email protected] /usr/local/src]# [[email protected] /usr/local/src]# ll total 992 drwxr-xr-x 8 1001 1001 158 Dec 4 2018 nginx-1.14.2 -rw-r--r-- 1 root root 1015384 Dec 4 2018 nginx-1.14.2.tar.gz [[email protected] /usr/local/src]# [[email protected] /usr/local/src]#
4>.准备编译安装的基础环境
[[email protected] ~]# yum install -y vim lrzsz tree screen psmisc lsof tcpdump wget ntpdate gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools iotop bc zip unzip zlib-devel bash-completion nfs-utils automake libxml2 libxml2-devel libxslt libxslt-devel perl perl-ExtUtils-EmbedLoaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.bit.edu.cn * extras: mirror.bit.edu.cn * updates: mirrors.huaweicloud.com Package 2:vim-enhanced-7.4.629-6.el7.x86_64 already installed and latest version Package lrzsz-0.12.20-36.el7.x86_64 already installed and latest version Package tree-1.6.0-10.el7.x86_64 already installed and latest version Package screen-4.1.0-0.25.20120314git3c2946.el7.x86_64 already installed and latest version Package psmisc-22.20-16.el7.x86_64 already installed and latest version Package lsof-4.87-6.el7.x86_64 already installed and latest version Package 14:tcpdump-4.9.2-4.el7_7.1.x86_64 already installed and latest version Package wget-1.14-18.el7_6.1.x86_64 already installed and latest version Package ntpdate-4.2.6p5-29.el7.centos.x86_64 already installed and latest version Package pcre-8.32-17.el7.x86_64 already installed and latest version Package bc-1.06.95-13.el7.x86_64 already installed and latest version Package zip-3.0-11.el7.x86_64 already installed and latest version Package libxml2-2.9.1-6.el7_2.3.x86_64 already installed and latest version Package libxslt-1.1.28-5.el7.x86_64 already installed and latest version Package 4:perl-5.16.3-294.el7_6.x86_64 already installed and latest version Resolving Dependencies --> Running transaction check ---> Package automake.noarch 0:1.13.4-3.el7 will be installed --> Processing Dependency: autoconf >= 2.65 for package: automake-1.13.4-3.el7.noarch --> Processing Dependency: perl(Thread::Queue) for package: automake-1.13.4-3.el7.noarch ---> Package bash-completion.noarch 1:2.1-6.el7 will be installed ---> Package gcc.x86_64 0:4.8.5-39.el7 will be installed --> Processing Dependency: libgomp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64 --> Processing Dependency: cpp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64 --> Processing Dependency: libgcc >= 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64 --> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-39.el7.x86_64 --> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-39.el7.x86_64 ---> Package gcc-c++.x86_64 0:4.8.5-39.el7 will be installed --> Processing Dependency: libstdc++-devel = 4.8.5-39.el7 for package: gcc-c++-4.8.5-39.el7.x86_64 --> Processing Dependency: libstdc++ = 4.8.5-39.el7 for package: gcc-c++-4.8.5-39.el7.x86_64 ---> Package glibc.x86_64 0:2.17-260.el7_6.6 will be updated --> Processing Dependency: glibc = 2.17-260.el7_6.6 for package: glibc-common-2.17-260.el7_6.6.x86_64 --> Processing Dependency: glibc = 2.17-260.el7_6.6 for package: glibc-headers-2.17-260.el7_6.6.x86_64 ---> Package glibc.x86_64 0:2.17-292.el7 will be an update ---> Package glibc-devel.x86_64 0:2.17-260.el7_6.6 will be updated ---> Package glibc-devel.x86_64 0:2.17-292.el7 will be an update ---> Package iotop.noarch 0:0.6-4.el7 will be installed ---> Package libxml2-devel.x86_64 0:2.9.1-6.el7_2.3 will be installed --> Processing Dependency: xz-devel for package: libxml2-devel-2.9.1-6.el7_2.3.x86_64 ---> Package libxslt-devel.x86_64 0:1.1.28-5.el7 will be installed --> Processing Dependency: libgcrypt-devel for package: libxslt-devel-1.1.28-5.el7.x86_64 ---> Package net-tools.x86_64 0:2.0-0.24.20131004git.el7 will be updated ---> Package net-tools.x86_64 0:2.0-0.25.20131004git.el7 will be an update ---> Package nfs-utils.x86_64 1:1.3.0-0.65.el7 will be installed --> Processing Dependency: libtirpc >= 0.2.4-0.7 for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 --> Processing Dependency: gssproxy >= 0.7.0-3 for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 --> Processing Dependency: rpcbind for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 --> Processing Dependency: quota for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 --> Processing Dependency: libnfsidmap for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 --> Processing Dependency: libevent for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 --> Processing Dependency: keyutils for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 --> Processing Dependency: libtirpc.so.1()(64bit) for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 --> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 --> Processing Dependency: libevent-2.0.so.5()(64bit) for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64 ---> Package openssl.x86_64 1:1.0.2k-16.el7 will be updated ---> Package openssl.x86_64 1:1.0.2k-19.el7 will be an update --> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-19.el7 for package: 1:openssl-1.0.2k-19.el7.x86_64 ---> Package openssl-devel.x86_64 1:1.0.2k-19.el7 will be installed --> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.2k-19.el7.x86_64 ---> Package pcre-devel.x86_64 0:8.32-17.el7 will be installed ---> Package perl-ExtUtils-Embed.noarch 0:1.30-294.el7_6 will be installed ---> Package systemd-devel.x86_64 0:219-67.el7_7.2 will be installed --> Processing Dependency: systemd-libs = 219-67.el7_7.2 for package: systemd-devel-219-67.el7_7.2.x86_64 --> Processing Dependency: systemd = 219-67.el7_7.2 for package: systemd-devel-219-67.el7_7.2.x86_64 ---> Package unzip.x86_64 0:6.0-19.el7 will be updated ---> Package unzip.x86_64 0:6.0-20.el7 will be an update ---> Package zlib-devel.x86_64 0:1.2.7-18.el7 will be installed --> Running transaction check ---> Package autoconf.noarch 0:2.69-11.el7 will be installed ---> Package cpp.x86_64 0:4.8.5-39.el7 will be installed ---> Package glibc-common.x86_64 0:2.17-260.el7_6.6 will be updated ---> Package glibc-common.x86_64 0:2.17-292.el7 will be an update ---> Package glibc-headers.x86_64 0:2.17-260.el7_6.6 will be updated ---> Package glibc-headers.x86_64 0:2.17-292.el7 will be an update ---> Package gssproxy.x86_64 0:0.7.0-26.el7 will be installed --> Processing Dependency: libini_config >= 1.3.1-31 for package: gssproxy-0.7.0-26.el7.x86_64 --> Processing Dependency: libverto-module-base for package: gssproxy-0.7.0-26.el7.x86_64 --> Processing Dependency: libref_array.so.1(REF_ARRAY_0.1.1)(64bit) for package: gssproxy-0.7.0-26.el7.x86_64 --> Processing Dependency: libini_config.so.3(INI_CONFIG_1.2.0)(64bit) for package: gssproxy-0.7.0-26.el7.x86_64 --> Processing Dependency: libini_config.so.3(INI_CONFIG_1.1.0)(64bit) for package: gssproxy-0.7.0-26.el7.x86_64 --> Processing Dependency: libref_array.so.1()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64 --> Processing Dependency: libini_config.so.3()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64 --> Processing Dependency: libcollection.so.2()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64 --> Processing Dependency: libbasicobjects.so.0()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64 ---> Package keyutils.x86_64 0:1.5.8-3.el7 will be installed ---> Package krb5-devel.x86_64 0:1.15.1-37.el7_7.2 will be installed --> Processing Dependency: libkadm5(x86-64) = 1.15.1-37.el7_7.2 for package: krb5-devel-1.15.1-37.el7_7.2.x86_64 --> Processing Dependency: krb5-libs(x86-64) = 1.15.1-37.el7_7.2 for package: krb5-devel-1.15.1-37.el7_7.2.x86_64 --> Processing Dependency: libverto-devel for package: krb5-devel-1.15.1-37.el7_7.2.x86_64 --> Processing Dependency: libselinux-devel for package: krb5-devel-1.15.1-37.el7_7.2.x86_64 --> Processing Dependency: libcom_err-devel for package: krb5-devel-1.15.1-37.el7_7.2.x86_64 --> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.15.1-37.el7_7.2.x86_64 ---> Package libevent.x86_64 0:2.0.21-4.el7 will be installed ---> Package libgcc.x86_64 0:4.8.5-36.el7 will be updated ---> Package libgcc.x86_64 0:4.8.5-39.el7 will be an update ---> Package libgcrypt-devel.x86_64 0:1.5.3-14.el7 will be installed --> Processing Dependency: libgpg-error-devel for package: libgcrypt-devel-1.5.3-14.el7.x86_64 ---> Package libgomp.x86_64 0:4.8.5-36.el7 will be updated ---> Package libgomp.x86_64 0:4.8.5-39.el7 will be an update ---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed ---> Package libnfsidmap.x86_64 0:0.25-19.el7 will be installed ---> Package libstdc++.x86_64 0:4.8.5-36.el7 will be updated ---> Package libstdc++.x86_64 0:4.8.5-39.el7 will be an update ---> Package libstdc++-devel.x86_64 0:4.8.5-39.el7 will be installed ---> Package libtirpc.x86_64 0:0.2.4-0.16.el7 will be installed ---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed ---> Package openssl-libs.x86_64 1:1.0.2k-16.el7 will be updated ---> Package openssl-libs.x86_64 1:1.0.2k-19.el7 will be an update ---> Package perl-Thread-Queue.noarch 0:3.02-2.el7 will be installed ---> Package quota.x86_64 1:4.01-19.el7 will be installed --> Processing Dependency: quota-nls = 1:4.01-19.el7 for package: 1:quota-4.01-19.el7.x86_64 --> Processing Dependency: tcp_wrappers for package: 1:quota-4.01-19.el7.x86_64 ---> Package rpcbind.x86_64 0:0.2.0-48.el7 will be installed ---> Package systemd.x86_64 0:219-62.el7 will be updated --> Processing Dependency: systemd = 219-62.el7 for package: systemd-sysv-219-62.el7.x86_64 ---> Package systemd.x86_64 0:219-67.el7_7.2 will be an update ---> Package systemd-libs.x86_64 0:219-62.el7 will be updated ---> Package systemd-libs.x86_64 0:219-67.el7_7.2 will be an update ---> Package xz-devel.x86_64 0:5.2.2-1.el7 will be installed --> 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-34.el7 will be updated ---> Package krb5-libs.x86_64 0:1.15.1-37.el7_7.2 will be an update ---> Package libbasicobjects.x86_64 0:0.1.1-32.el7 will be installed ---> Package libcollection.x86_64 0:0.7.0-32.el7 will be installed ---> Package libcom_err-devel.x86_64 0:1.42.9-16.el7 will be installed --> Processing Dependency: libcom_err(x86-64) = 1.42.9-16.el7 for package: libcom_err-devel-1.42.9-16.el7.x86_64 ---> Package libgpg-error-devel.x86_64 0:1.12-3.el7 will be installed ---> Package libini_config.x86_64 0:1.3.1-32.el7 will be installed --> Processing Dependency: libpath_utils.so.1(PATH_UTILS_0.2.1)(64bit) for package: libini_config-1.3.1-32.el7.x86_64 --> Processing Dependency: libpath_utils.so.1()(64bit) for package: libini_config-1.3.1-32.el7.x86_64 ---> Package libkadm5.x86_64 0:1.15.1-37.el7_7.2 will be installed ---> Package libref_array.x86_64 0:0.1.5-32.el7 will be installed ---> Package libselinux-devel.x86_64 0:2.5-14.1.el7 will be installed --> Processing Dependency: libsepol-devel(x86-64) >= 2.5-10 for package: libselinux-devel-2.5-14.1.el7.x86_64 --> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.5-14.1.el7.x86_64 ---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed ---> Package libverto-libevent.x86_64 0:0.2.5-4.el7 will be installed ---> Package quota-nls.noarch 1:4.01-19.el7 will be installed ---> Package systemd-sysv.x86_64 0:219-62.el7 will be updated ---> Package systemd-sysv.x86_64 0:219-67.el7_7.2 will be an update ---> Package tcp_wrappers.x86_64 0:7.6-77.el7 will be installed --> Running transaction check ---> Package libcom_err.x86_64 0:1.42.9-13.el7 will be updated --> Processing Dependency: libcom_err(x86-64) = 1.42.9-13.el7 for package: e2fsprogs-1.42.9-13.el7.x86_64 --> Processing Dependency: libcom_err(x86-64) = 1.42.9-13.el7 for package: e2fsprogs-libs-1.42.9-13.el7.x86_64 --> Processing Dependency: libcom_err(x86-64) = 1.42.9-13.el7 for package: libss-1.42.9-13.el7.x86_64 ---> Package libcom_err.x86_64 0:1.42.9-16.el7 will be an update ---> Package libpath_utils.x86_64 0:0.2.1-32.el7 will be installed ---> Package libsepol-devel.x86_64 0:2.5-10.el7 will be installed --> Running transaction check ---> Package e2fsprogs.x86_64 0:1.42.9-13.el7 will be updated ---> Package e2fsprogs.x86_64 0:1.42.9-16.el7 will be an update ---> Package e2fsprogs-libs.x86_64 0:1.42.9-13.el7 will be updated ---> Package e2fsprogs-libs.x86_64 0:1.42.9-16.el7 will be an update ---> Package libss.x86_64 0:1.42.9-13.el7 will be updated ---> Package libss.x86_64 0:1.42.9-16.el7 will be an update --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: automake noarch 1.13.4-3.el7 base 679 k bash-completion noarch 1:2.1-6.el7 base 85 k gcc x86_64 4.8.5-39.el7 base 16 M gcc-c++ x86_64 4.8.5-39.el7 base 7.2 M iotop noarch 0.6-4.el7 base 52 k libxml2-devel x86_64 2.9.1-6.el7_2.3 base 1.0 M libxslt-devel x86_64 1.1.28-5.el7 base 309 k nfs-utils x86_64 1:1.3.0-0.65.el7 base 412 k openssl-devel x86_64 1:1.0.2k-19.el7 base 1.5 M pcre-devel x86_64 8.32-17.el7 base 480 k perl-ExtUtils-Embed noarch 1.30-294.el7_6 base 50 k systemd-devel x86_64 219-67.el7_7.2 updates 207 k zlib-devel x86_64 1.2.7-18.el7 base 50 k Updating: glibc x86_64 2.17-292.el7 base 3.6 M glibc-devel x86_64 2.17-292.el7 base 1.1 M net-tools x86_64 2.0-0.25.20131004git.el7 base 306 k openssl x86_64 1:1.0.2k-19.el7 base 493 k unzip x86_64 6.0-20.el7 base 170 k Installing for dependencies: autoconf noarch 2.69-11.el7 base 701 k cpp x86_64 4.8.5-39.el7 base 5.9 M gssproxy x86_64 0.7.0-26.el7 base 110 k keyutils x86_64 1.5.8-3.el7 base 54 k keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k krb5-devel x86_64 1.15.1-37.el7_7.2 updates 272 k libbasicobjects x86_64 0.1.1-32.el7 base 26 k libcollection x86_64 0.7.0-32.el7 base 42 k libcom_err-devel x86_64 1.42.9-16.el7 base 32 k libevent x86_64 2.0.21-4.el7 base 214 k libgcrypt-devel x86_64 1.5.3-14.el7 base 129 k libgpg-error-devel x86_64 1.12-3.el7 base 16 k libini_config x86_64 1.3.1-32.el7 base 64 k libkadm5 x86_64 1.15.1-37.el7_7.2 updates 178 k libmpc x86_64 1.0.1-3.el7 base 51 k libnfsidmap x86_64 0.25-19.el7 base 50 k libpath_utils x86_64 0.2.1-32.el7 base 28 k libref_array x86_64 0.1.5-32.el7 base 27 k libselinux-devel x86_64 2.5-14.1.el7 base 187 k libsepol-devel x86_64 2.5-10.el7 base 77 k libstdc++-devel x86_64 4.8.5-39.el7 base 1.5 M libtirpc x86_64 0.2.4-0.16.el7 base 89 k libverto-devel x86_64 0.2.5-4.el7 base 12 k libverto-libevent x86_64 0.2.5-4.el7 base 8.9 k mpfr x86_64 3.1.1-4.el7 base 203 k perl-Thread-Queue noarch 3.02-2.el7 base 17 k quota x86_64 1:4.01-19.el7 base 179 k quota-nls noarch 1:4.01-19.el7 base 90 k rpcbind x86_64 0.2.0-48.el7 base 60 k tcp_wrappers x86_64 7.6-77.el7 base 78 k xz-devel x86_64 5.2.2-1.el7 base 46 k Updating for dependencies: e2fsprogs x86_64 1.42.9-16.el7 base 700 k e2fsprogs-libs x86_64 1.42.9-16.el7 base 167 k glibc-common x86_64 2.17-292.el7 base 11 M glibc-headers x86_64 2.17-292.el7 base 687 k krb5-libs x86_64 1.15.1-37.el7_7.2 updates 805 k libcom_err x86_64 1.42.9-16.el7 base 41 k libgcc x86_64 4.8.5-39.el7 base 102 k libgomp x86_64 4.8.5-39.el7 base 158 k libss x86_64 1.42.9-16.el7 base 46 k libstdc++ x86_64 4.8.5-39.el7 base 305 k openssl-libs x86_64 1:1.0.2k-19.el7 base 1.2 M systemd x86_64 219-67.el7_7.2 updates 5.1 M systemd-libs x86_64 219-67.el7_7.2 updates 411 k systemd-sysv x86_64 219-67.el7_7.2 updates 88 k Transaction Summary ============================================================================================================================================================================ Install 13 Packages (+31 Dependent packages) Upgrade 5 Packages (+14 Dependent packages) Total download size: 65 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/63): automake-1.13.4-3.el7.noarch.rpm | 679 kB 00:00:00 (2/63): autoconf-2.69-11.el7.noarch.rpm | 701 kB 00:00:00 (3/63): bash-completion-2.1-6.el7.noarch.rpm | 85 kB 00:00:00 (4/63): e2fsprogs-libs-1.42.9-16.el7.x86_64.rpm | 167 kB 00:00:00 (5/63): gcc-4.8.5-39.el7.x86_64.rpm | 16 MB 00:00:01 (6/63): gcc-c++-4.8.5-39.el7.x86_64.rpm | 7.2 MB 00:00:00 (7/63): glibc-2.17-292.el7.x86_64.rpm | 3.6 MB 00:00:00 (8/63): glibc-common-2.17-292.el7.x86_64.rpm | 11 MB 00:00:01 (9/63): glibc-devel-2.17-292.el7.x86_64.rpm | 1.1 MB 00:00:00 (10/63): glibc-headers-2.17-292.el7.x86_64.rpm | 687 kB 00:00:00 (11/63): gssproxy-0.7.0-26.el7.x86_64.rpm | 110 kB 00:00:00 (12/63): iotop-0.6-4.el7.noarch.rpm | 52 kB 00:00:00 (13/63): keyutils-1.5.8-3.el7.x86_64.rpm | 54 kB 00:00:00 (14/63): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm | 37 kB 00:00:00 (15/63): libbasicobjects-0.1.1-32.el7.x86_64.rpm | 26 kB 00:00:00 (16/63): libcollection-0.7.0-32.el7.x86_64.rpm | 42 kB 00:00:00 (17/63): libcom_err-1.42.9-16.el7.x86_64.rpm | 41 kB 00:00:00 (18/63): libcom_err-devel-1.42.9-16.el7.x86_64.rpm | 32 kB 00:00:00 (19/63): libevent-2.0.21-4.el7.x86_64.rpm | 214 kB 00:00:00 (20/63): libgcc-4.8.5-39.el7.x86_64.rpm | 102 kB 00:00:00 (21/63): krb5-devel-1.15.1-37.el7_7.2.x86_64.rpm | 272 kB 00:00:00 (22/63): libgcrypt-devel-1.5.3-14.el7.x86_64.rpm | 129 kB 00:00:00 (23/63): krb5-libs-1.15.1-37.el7_7.2.x86_64.rpm | 805 kB 00:00:00 (24/63): libgomp-4.8.5-39.el7.x86_64.rpm | 158 kB 00:00:00 (25/63): libgpg-error-devel-1.12-3.el7.x86_64.rpm | 16 kB 00:00:00 (26/63): cpp-4.8.5-39.el7.x86_64.rpm | 5.9 MB 00:00:05 (27/63): libini_config-1.3.1-32.el7.x86_64.rpm | 64 kB 00:00:00 (28/63): libmpc-1.0.1-3.el7.x86_64.rpm | 51 kB 00:00:00 (29/63): libnfsidmap-0.25-19.el7.x86_64.rpm | 50 kB 00:00:00 (30/63): libpath_utils-0.2.1-32.el7.x86_64.rpm | 28 kB 00:00:00 (31/63): libref_array-0.1.5-32.el7.x86_64.rpm | 27 kB 00:00:00 (32/63): libsepol-devel-2.5-10.el7.x86_64.rpm | 77 kB 00:00:00 (33/63): libselinux-devel-2.5-14.1.el7.x86_64.rpm | 187 kB 00:00:00 (34/63): libss-1.42.9-16.el7.x86_64.rpm | 46 kB 00:00:00 (35/63): libstdc++-4.8.5-39.el7.x86_64.rpm | 305 kB 00:00:00 (36/63): libkadm5-1.15.1-37.el7_7.2.x86_64.rpm | 178 kB 00:00:00 (37/63): libtirpc-0.2.4-0.16.el7.x86_64.rpm | 89 kB 00:00:00 (38/63): libverto-devel-0.2.5-4.el7.x86_64.rpm | 12 kB 00:00:00 (39/63): libstdc++-devel-4.8.5-39.el7.x86_64.rpm | 1.5 MB 00:00:00 (40/63): libverto-libevent-0.2.5-4.el7.x86_64.rpm | 8.9 kB 00:00:00 (41/63): libxslt-devel-1.1.28-5.el7.x86_64.rpm | 309 kB 00:00:00 (42/63): libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm | 1.0 MB 00:00:00 (43/63): mpfr-3.1.1-4.el7.x86_64.rpm | 203 kB 00:00:00 (44/63): net-tools-2.0-0.25.20131004git.el7.x86_64.rpm | 306 kB 00:00:00 (45/63): nfs-utils-1.3.0-0.65.el7.x86_64.rpm | 412 kB 00:00:00 (46/63): openssl-1.0.2k-19.el7.x86_64.rpm | 493 kB 00:00:00 (47/63): e2fsprogs-1.42.9-16.el7.x86_64.rpm | 700 kB 00:00:05 (48/63): openssl-libs-1.0.2k-19.el7.x86_64.rpm | 1.2 MB 00:00:00 (49/63): pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:00:00 (50/63): openssl-devel-1.0.2k-19.el7.x86_64.rpm | 1.5 MB 00:00:00 (51/63): perl-ExtUtils-Embed-1.30-294.el7_6.noarch.rpm | 50 kB 00:00:00 (52/63): perl-Thread-Queue-3.02-2.el7.noarch.rpm | 17 kB 00:00:00 (53/63): quota-4.01-19.el7.x86_64.rpm | 179 kB 00:00:00 (54/63): quota-nls-4.01-19.el7.noarch.rpm | 90 kB 00:00:00 (55/63): rpcbind-0.2.0-48.el7.x86_64.rpm | 60 kB 00:00:00 (56/63): tcp_wrappers-7.6-77.el7.x86_64.rpm | 78 kB 00:00:00 (57/63): unzip-6.0-20.el7.x86_64.rpm | 170 kB 00:00:00 (58/63): systemd-devel-219-67.el7_7.2.x86_64.rpm | 207 kB 00:00:00 (59/63): xz-devel-5.2.2-1.el7.x86_64.rpm | 46 kB 00:00:00 (60/63): systemd-sysv-219-67.el7_7.2.x86_64.rpm | 88 kB 00:00:00 (61/63): systemd-libs-219-67.el7_7.2.x86_64.rpm | 411 kB 00:00:00 (62/63): zlib-devel-1.2.7-18.el7.x86_64.rpm | 50 kB 00:00:05 (63/63): systemd-219-67.el7_7.2.x86_64.rpm | 5.1 MB 00:00:06 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 5.0 MB/s | 65 MB 00:00:13 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : libgcc-4.8.5-39.el7.x86_64 1/82 Updating : glibc-common-2.17-292.el7.x86_64 2/82 Updating : glibc-2.17-292.el7.x86_64 3/82 warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew Updating : libcom_err-1.42.9-16.el7.x86_64 4/82 Updating : krb5-libs-1.15.1-37.el7_7.2.x86_64 5/82 Updating : 1:openssl-libs-1.0.2k-19.el7.x86_64 6/82 Installing : mpfr-3.1.1-4.el7.x86_64 7/82 Installing : libmpc-1.0.1-3.el7.x86_64 8/82 Updating : systemd-libs-219-67.el7_7.2.x86_64 9/82 Updating : systemd-219-67.el7_7.2.x86_64 10/82 Installing : libevent-2.0.21-4.el7.x86_64 11/82 Installing : libtirpc-0.2.4-0.16.el7.x86_64 12/82 Updating : e2fsprogs-libs-1.42.9-16.el7.x86_64 13/82 Updating : libstdc++-4.8.5-39.el7.x86_64 14/82 Installing : libbasicobjects-0.1.1-32.el7.x86_64 15/82 Installing : libref_array-0.1.5-32.el7.x86_64 16/82 Installing : libcollection-0.7.0-32.el7.x86_64 17/82 Installing : zlib-devel-1.2.7-18.el7.x86_64 18/82 Installing : libstdc++-devel-4.8.5-39.el7.x86_64 19/82 Installing : libverto-libevent-0.2.5-4.el7.x86_64 20/82 Updating : systemd-sysv-219-67.el7_7.2.x86_64 21/82 Installing : rpcbind-0.2.0-48.el7.x86_64 22/82 Installing : cpp-4.8.5-39.el7.x86_64 23/82 Installing : libkadm5-1.15.1-37.el7_7.2.x86_64 24/82 Updating : libss-1.42.9-16.el7.x86_64 25/82 Installing : libcom_err-devel-1.42.9-16.el7.x86_64 26/82 Installing : libpath_utils-0.2.1-32.el7.x86_64 27/82 Installing : libini_config-1.3.1-32.el7.x86_64 28/82 Installing : gssproxy-0.7.0-26.el7.x86_64 29/82 Installing : tcp_wrappers-7.6-77.el7.x86_64 30/82 Updating : libgomp-4.8.5-39.el7.x86_64 31/82 Updating : glibc-headers-2.17-292.el7.x86_64 32/82 Updating : glibc-devel-2.17-292.el7.x86_64 33/82 Installing : gcc-4.8.5-39.el7.x86_64 34/82 Installing : keyutils-1.5.8-3.el7.x86_64 35/82 Installing : libnfsidmap-0.25-19.el7.x86_64 36/82 Installing : libgpg-error-devel-1.12-3.el7.x86_64 37/82 Installing : libgcrypt-devel-1.5.3-14.el7.x86_64 38/82 Installing : autoconf-2.69-11.el7.noarch 39/82 Installing : xz-devel-5.2.2-1.el7.x86_64 40/82 Installing : libxml2-devel-2.9.1-6.el7_2.3.x86_64 41/82 Installing : 1:quota-nls-4.01-19.el7.noarch 42/82 Installing : 1:quota-4.01-19.el7.x86_64 43/82 Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64 44/82 Installing : perl-Thread-Queue-3.02-2.el7.noarch 45/82 Installing : libverto-devel-0.2.5-4.el7.x86_64 46/82 Installing : libsepol-devel-2.5-10.el7.x86_64 47/82 Installing : pcre-devel-8.32-17.el7.x86_64 48/82 Installing : libselinux-devel-2.5-14.1.el7.x86_64 49/82 Installing : krb5-devel-1.15.1-37.el7_7.2.x86_64 50/82 Installing : 1:openssl-devel-1.0.2k-19.el7.x86_64 51/82 Installing : automake-1.13.4-3.el7.noarch 52/82 Installing : 1:nfs-utils-1.3.0-0.65.el7.x86_64 53/82 Installing : libxslt-devel-1.1.28-5.el7.x86_64 54/82 Installing : gcc-c++-4.8.5-39.el7.x86_64 55/82 Updating : e2fsprogs-1.42.9-16.el7.x86_64 56/82 Updating : net-tools-2.0-0.25.20131004git.el7.x86_64 57/82 Installing : systemd-devel-219-67.el7_7.2.x86_64 58/82 Updating : 1:openssl-1.0.2k-19.el7.x86_64 59/82 Updating : unzip-6.0-20.el7.x86_64 60/82 Installing : 1:bash-completion-2.1-6.el7.noarch 61/82 Installing : iotop-0.6-4.el7.noarch 62/82 Installing : perl-ExtUtils-Embed-1.30-294.el7_6.noarch 63/82 Cleanup : glibc-devel-2.17-260.el7_6.6.x86_64 64/82 Cleanup : glibc-headers-2.17-260.el7_6.6.x86_64 65/82 Cleanup : systemd-sysv-219-62.el7.x86_64 66/82 Cleanup : 1:openssl-1.0.2k-16.el7.x86_64 67/82 Cleanup : e2fsprogs-1.42.9-13.el7.x86_64 68/82 Cleanup : krb5-libs-1.15.1-34.el7.x86_64 69/82 Cleanup : 1:openssl-libs-1.0.2k-16.el7.x86_64 70/82 Cleanup : e2fsprogs-libs-1.42.9-13.el7.x86_64 71/82 Cleanup : libss-1.42.9-13.el7.x86_64 72/82 Cleanup : libstdc++-4.8.5-36.el7.x86_64 73/82 Cleanup : net-tools-2.0-0.24.20131004git.el7.x86_64 74/82 Cleanup : systemd-219-62.el7.x86_64 75/82 Cleanup : systemd-libs-219-62.el7.x86_64 76/82 Cleanup : libcom_err-1.42.9-13.el7.x86_64 77/82 Cleanup : libgomp-4.8.5-36.el7.x86_64 78/82 Cleanup : unzip-6.0-19.el7.x86_64 79/82 Cleanup : glibc-common-2.17-260.el7_6.6.x86_64 80/82 Cleanup : glibc-2.17-260.el7_6.6.x86_64 81/82 Cleanup : libgcc-4.8.5-36.el7.x86_64 82/82 Verifying : libtirpc-0.2.4-0.16.el7.x86_64 1/82 Verifying : libxml2-devel-2.9.1-6.el7_2.3.x86_64 2/82 Verifying : krb5-devel-1.15.1-37.el7_7.2.x86_64 3/82 Verifying : perl-ExtUtils-Embed-1.30-294.el7_6.noarch 4/82 Verifying : iotop-0.6-4.el7.noarch 5/82 Verifying : systemd-sysv-219-67.el7_7.2.x86_64 6/82 Verifying : libxslt-devel-1.1.28-5.el7.x86_64 7/82 Verifying : libss-1.42.9-16.el7.x86_64 8/82 Verifying : systemd-libs-219-67.el7_7.2.x86_64 9/82 Verifying : 1:nfs-utils-1.3.0-0.65.el7.x86_64 10/82 Verifying : pcre-devel-8.32-17.el7.x86_64 11/82 Verifying : gcc-4.8.5-39.el7.x86_64 12/82 Verifying : unzip-6.0-20.el7.x86_64 13/82 Verifying : e2fsprogs-1.42.9-16.el7.x86_64 14/82 Verifying : libstdc++-4.8.5-39.el7.x86_64 15/82 Verifying : libkadm5-1.15.1-37.el7_7.2.x86_64 16/82 Verifying : libsepol-devel-2.5-10.el7.x86_64 17/82 Verifying : 1:openssl-libs-1.0.2k-19.el7.x86_64 18/82 Verifying : libpath_utils-0.2.1-32.el7.x86_64 19/82 Verifying : 1:bash-completion-2.1-6.el7.noarch 20/82 Verifying : libverto-devel-0.2.5-4.el7.x86_64 21/82 Verifying : tcp_wrappers-7.6-77.el7.x86_64 22/82 Verifying : zlib-devel-1.2.7-18.el7.x86_64 23/82 Verifying : e2fsprogs-libs-1.42.9-16.el7.x86_64 24/82 Verifying : perl-Thread-Queue-3.02-2.el7.noarch 25/82 Verifying : net-tools-2.0-0.25.20131004git.el7.x86_64 26/82 Verifying : libgcc-4.8.5-39.el7.x86_64 27/82 Verifying : libgomp-4.8.5-39.el7.x86_64 28/82 Verifying : libbasicobjects-0.1.1-32.el7.x86_64 29/82 Verifying : systemd-devel-219-67.el7_7.2.x86_64 30/82 Verifying : libstdc++-devel-4.8.5-39.el7.x86_64 31/82 Verifying : libini_config-1.3.1-32.el7.x86_64 32/82 Verifying : libref_array-0.1.5-32.el7.x86_64 33/82 Verifying : krb5-libs-1.15.1-37.el7_7.2.x86_64 34/82 Verifying : keyutils-libs-devel-1.5.8-3.el7.x86_64 35/82 Verifying : glibc-headers-2.17-292.el7.x86_64 36/82 Verifying : gcc-c++-4.8.5-39.el7.x86_64 37/82 Verifying : libevent-2.0.21-4.el7.x86_64 38/82 Verifying : 1:openssl-1.0.2k-19.el7.x86_64 39/82 Verifying : libcom_err-devel-1.42.9-16.el7.x86_64 40/82 Verifying : libverto-libevent-0.2.5-4.el7.x86_64 41/82 Verifying : 1:openssl-devel-1.0.2k-19.el7.x86_64 42/82 Verifying : libmpc-1.0.1-3.el7.x86_64 43/82 Verifying : libcom_err-1.42.9-16.el7.x86_64 44/82 Verifying : glibc-2.17-292.el7.x86_64 45/82 Verifying : 1:quota-nls-4.01-19.el7.noarch 46/82 Verifying : rpcbind-0.2.0-48.el7.x86_64 47/82 Verifying : automake-1.13.4-3.el7.noarch 48/82 Verifying : glibc-common-2.17-292.el7.x86_64 49/82 Verifying : glibc-devel-2.17-292.el7.x86_64 50/82 Verifying : xz-devel-5.2.2-1.el7.x86_64 51/82 Verifying : gssproxy-0.7.0-26.el7.x86_64 52/82 Verifying : autoconf-2.69-11.el7.noarch 53/82 Verifying : libgcrypt-devel-1.5.3-14.el7.x86_64 54/82 Verifying : mpfr-3.1.1-4.el7.x86_64 55/82 Verifying : keyutils-1.5.8-3.el7.x86_64 56/82 Verifying : libcollection-0.7.0-32.el7.x86_64 57/82 Verifying : libnfsidmap-0.25-19.el7.x86_64 58/82 Verifying : libgpg-error-devel-1.12-3.el7.x86_64 59/82 Verifying : libselinux-devel-2.5-14.1.el7.x86_64 60/82 Verifying : cpp-4.8.5-39.el7.x86_64 61/82 Verifying : 1:quota-4.01-19.el7.x86_64 62/82 Verifying : systemd-219-67.el7_7.2.x86_64 63/82 Verifying : libcom_err-1.42.9-13.el7.x86_64 64/82 Verifying : glibc-2.17-260.el7_6.6.x86_64 65/82 Verifying : glibc-headers-2.17-260.el7_6.6.x86_64 66/82 Verifying : libstdc++-4.8.5-36.el7.x86_64 67/82 Verifying : 1:openssl-libs-1.0.2k-16.el7.x86_64 68/82 Verifying : libss-1.42.9-13.el7.x86_64 69/82 Verifying : e2fsprogs-1.42.9-13.el7.x86_64 70/82 Verifying : 1:openssl-1.0.2k-16.el7.x86_64 71/82 Verifying : systemd-sysv-219-62.el7.x86_64 72/82 Verifying : net-tools-2.0-0.24.20131004git.el7.x86_64 73/82 Verifying : systemd-libs-219-62.el7.x86_64 74/82 Verifying : libgomp-4.8.5-36.el7.x86_64 75/82 Verifying : systemd-219-62.el7.x86_64 76/82 Verifying : glibc-devel-2.17-260.el7_6.6.x86_64 77/82 Verifying : e2fsprogs-libs-1.42.9-13.el7.x86_64 78/82 Verifying : libgcc-4.8.5-36.el7.x86_64 79/82 Verifying : krb5-libs-1.15.1-34.el7.x86_64 80/82 Verifying : unzip-6.0-19.el7.x86_64 81/82 Verifying : glibc-common-2.17-260.el7_6.6.x86_64 82/82 Installed: automake.noarch 0:1.13.4-3.el7 bash-completion.noarch 1:2.1-6.el7 gcc.x86_64 0:4.8.5-39.el7 gcc-c++.x86_64 0:4.8.5-39.el7 iotop.noarch 0:0.6-4.el7 libxml2-devel.x86_64 0:2.9.1-6.el7_2.3 libxslt-devel.x86_64 0:1.1.28-5.el7 nfs-utils.x86_64 1:1.3.0-0.65.el7 openssl-devel.x86_64 1:1.0.2k-19.el7 pcre-devel.x86_64 0:8.32-17.el7 perl-ExtUtils-Embed.noarch 0:1.30-294.el7_6 systemd-devel.x86_64 0:219-67.el7_7.2 zlib-devel.x86_64 0:1.2.7-18.el7 Dependency Installed: autoconf.noarch 0:2.69-11.el7 cpp.x86_64 0:4.8.5-39.el7 gssproxy.x86_64 0:0.7.0-26.el7 keyutils.x86_64 0:1.5.8-3.el7 keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-37.el7_7.2 libbasicobjects.x86_64 0:0.1.1-32.el7 libcollection.x86_64 0:0.7.0-32.el7 libcom_err-devel.x86_64 0:1.42.9-16.el7 libevent.x86_64 0:2.0.21-4.el7 libgcrypt-devel.x86_64 0:1.5.3-14.el7 libgpg-error-devel.x86_64 0:1.12-3.el7 libini_config.x86_64 0:1.3.1-32.el7 libkadm5.x86_64 0:1.15.1-37.el7_7.2 libmpc.x86_64 0:1.0.1-3.el7 libnfsidmap.x86_64 0:0.25-19.el7 libpath_utils.x86_64 0:0.2.1-32.el7 libref_array.x86_64 0:0.1.5-32.el7 libselinux-devel.x86_64 0:2.5-14.1.el7 libsepol-devel.x86_64 0:2.5-10.el7 libstdc++-devel.x86_64 0:4.8.5-39.el7 libtirpc.x86_64 0:0.2.4-0.16.el7 libverto-devel.x86_64 0:0.2.5-4.el7 libverto-libevent.x86_64 0:0.2.5-4.el7 mpfr.x86_64 0:3.1.1-4.el7 perl-Thread-Queue.noarch 0:3.02-2.el7 quota.x86_64 1:4.01-19.el7 quota-nls.noarch 1:4.01-19.el7 rpcbind.x86_64 0:0.2.0-48.el7 tcp_wrappers.x86_64 0:7.6-77.el7 xz-devel.x86_64 0:5.2.2-1.el7 Updated: glibc.x86_64 0:2.17-292.el7 glibc-devel.x86_64 0:2.17-292.el7 net-tools.x86_64 0:2.0-0.25.20131004git.el7 openssl.x86_64 1:1.0.2k-19.el7 unzip.x86_64 0:6.0-20.el7 Dependency Updated: e2fsprogs.x86_64 0:1.42.9-16.el7 e2fsprogs-libs.x86_64 0:1.42.9-16.el7 glibc-common.x86_64 0:2.17-292.el7 glibc-headers.x86_64 0:2.17-292.el7 krb5-libs.x86_64 0:1.15.1-37.el7_7.2 libcom_err.x86_64 0:1.42.9-16.el7 libgcc.x86_64 0:4.8.5-39.el7 libgomp.x86_64 0:4.8.5-39.el7 libss.x86_64 0:1.42.9-16.el7 libstdc++.x86_64 0:4.8.5-39.el7 openssl-libs.x86_64 1:1.0.2k-19.el7 systemd.x86_64 0:219-67.el7_7.2 systemd-libs.x86_64 0:219-67.el7_7.2 systemd-sysv.x86_64 0:219-67.el7_7.2 Complete! [[email protected] ~]#
gcc为GNU Compiler Collection的缩写,可以编译C和C++源代码等,它是GNU开发的C和C++以及其他很多种语言的编译器(最早的时候只能编译C,后来很快进化成一个编译多种语言的集合,如Fortran、Pascal、Objective-C、Java、Ada、 Go等。) gcc 在编译C++源代码的阶段,只能编译 C++ 源文件,而不能自动和 C++ 程序使用的库链接(编译过程分为编译、链接两个阶段,注意不要和可执行文件这个概念搞混,相对可执行文件来说有三个重要的概念:编译(compile)、链接(link)、加载(load)。源程序文件被编译成目标文件,多个目标文件连同库被链接成一个最终的可执行文件,可执行文件被加载到内存中运行)。因此,通常使用 g++ 命令来完成 C++ 程序的编译和连接,该程序会自动调用 gcc 实现编译。 gcc-c++也能编译C源代码,只不过把会把它当成C++源代码,后缀为.c的,gcc把它当作是C程序,而g++当作是c++程序;后缀为.cpp的,两者都会认为是c++程序,注意,虽然c++是c的超集,但是两者对语法的要求是有区别的。 automake是一个从Makefile.am文件自动生成Makefile.in的工具。为了生成Makefile.in,automake还需用到perl,由于automake创建的发布完全遵循GNU标准,所以在创建中不需要perl。libtool是一款方便生成各种程序库的工具。 pcre pcre-devel:在Nginx编译需要 PCRE(Perl Compatible Regular Expression),因为Nginx的Rewrite模块和HTTP 核心模块会使用到PCRE正则表达式语法。 zlip zlib-devel:nginx启用压缩功能的时候,需要此模块的支持。 openssl openssl-devel:开启SSL的时候需要此模块的支持。
5>.配置nginx模块(该步骤会检查nginx编译时需要的环境,如依赖包等,若不满足则会在配置过程中失败,并且会生成一个)
[[email protected] /usr/local/src]# [[email protected] /usr/local/src]# ll total 992 drwxr-xr-x 8 1001 1001 158 Dec 4 2018 nginx-1.14.2 -rw-r--r-- 1 root root 1015384 Dec 4 2018 nginx-1.14.2.tar.gz [[email protected] /usr/local/src]# [[email protected] /usr/local/src]# cd nginx-1.14.2 [[email protected] /usr/local/src/nginx-1.14.2]# [[email protected] /usr/local/src/nginx-1.14.2]# ll total 728 drwxr-xr-x 6 1001 1001 326 Dec 15 13:32 auto -rw-r--r-- 1 1001 1001 288742 Dec 4 2018 CHANGES -rw-r--r-- 1 1001 1001 440121 Dec 4 2018 CHANGES.ru drwxr-xr-x 2 1001 1001 168 Dec 15 13:32 conf -rwxr-xr-x 1 1001 1001 2502 Dec 4 2018 configure drwxr-xr-x 4 1001 1001 72 Dec 15 13:32 contrib drwxr-xr-x 2 1001 1001 40 Dec 15 13:32 html -rw-r--r-- 1 1001 1001 1397 Dec 4 2018 LICENSE drwxr-xr-x 2 1001 1001 21 Dec 15 13:32 man -rw-r--r-- 1 1001 1001 49 Dec 4 2018 README drwxr-xr-x 9 1001 1001 91 Dec 15 13:32 src [[email protected] /usr/local/src/nginx-1.14.2]# [[email protected] /usr/local/src/nginx-1.14.2]# file configure configure: POSIX shell script, ASCII text executable [[email protected] /usr/local/src/nginx-1.14.2]# [[email protected] /usr/local/src/nginx-1.14.2]# [[email protected] /usr/local/src/nginx-1.14.2]# ./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_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_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 [[email protected] /usr/local/src/nginx-1.14.2]#
[[email protected] /usr/local/src/nginx-1.14.2]# ./configure --prefix=/yinzhengjie/softwares/nginx \ #指定编译安装时的路径,这些编译参数在帮助信息均有记录哟~ > --user=nginx \ #指定以nginx用户运行服务 > --group=nginx \ #指定以nginx组运行服务 > --with-http_ssl_module \ #支持ssl功能 > --with-http_v2_module \ #支持http2功能 > --with-http_realip_module \ #做反向代理时可以转发真实的IP地址 > --with-http_stub_status_module \ #开启状态页 > --with-http_gzip_static_module \ #开启静态压缩功能 > --with-pcre \ #支持正则 > --with-stream \ #支持TCP代理的方式 > --with-stream_ssl_module \ > --with-stream_realip_module ...... checking for OpenSSL library ... found checking for zlib library ... found creating objs/Makefile Configuration summary + using system PCRE library + using system OpenSSL library + using system zlib library nginx path prefix: "/yinzhengjie/softwares/nginx" nginx binary file: "/yinzhengjie/softwares/nginx/sbin/nginx" nginx modules path: "/yinzhengjie/softwares/nginx/modules" nginx configuration prefix: "/yinzhengjie/softwares/nginx/conf" nginx configuration file: "/yinzhengjie/softwares/nginx/conf/nginx.conf" nginx pid file: "/yinzhengjie/softwares/nginx/logs/nginx.pid" nginx error log file: "/yinzhengjie/softwares/nginx/logs/error.log" nginx http access log file: "/yinzhengjie/softwares/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" [[email protected] /usr/local/src/nginx-1.14.2]# echo $? 0 [[email protected] /usr/local/src/nginx-1.14.2]# [[email protected] /usr/local/src/nginx-1.14.2]# ll Makefile #注意,"./configure"这个步骤会有两个操作,第一是检查编译安装需要依赖的软件包等环境,如果缺少依赖包则配置不成功;第二是会生成Makefile的配置文件哟~ -rw-r--r-- 1 root root 424 Dec 15 13:47 Makefile [[email protected] /usr/local/src/nginx-1.14.2]# [[email protected] /usr/local/src/nginx-1.14.2]# date Sun Dec 15 13:48:44 CST 2019 [[email protected] /usr/local/src/nginx-1.14.2]#
[[email protected] /usr/local/src/nginx-1.14.2]# cat Makefile default: build clean: rm -rf Makefile objs build: $(MAKE) -f objs/Makefile install: $(MAKE) -f objs/Makefile install modules: $(MAKE) -f objs/Makefile modules upgrade: /yinzhengjie/softwares/nginx/sbin/nginx -t kill -USR2 `cat /yinzhengjie/softwares/nginx/logs/nginx.pid` sleep 1 test -f /yinzhengjie/softwares/nginx/logs/nginx.pid.oldbin kill -QUIT `cat /yinzhengjie/softwares/nginx/logs/nginx.pid.oldbin` [[email protected] /usr/local/src/nginx-1.14.2]#
6>.编译(该步骤会根据Makefile文件生成相应的模块)
[[email protected] /usr/local/src/nginx-1.14.2]# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 158 Model name: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Stepping: 10 CPU MHz: 2208.000 BogoMIPS: 4416.00 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 9216K NUMA node0 CPU(s): 0-3 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase avx2 invpcid rdseed clflushopt flush_l1d[[email protected] /usr/local/src/nginx-1.14.2]#
[[email protected] /usr/local/src/nginx-1.14.2]# make -j 4 ...... objs/src/stream/ngx_stream_ssl_module.o \ objs/src/stream/ngx_stream_realip_module.o \ objs/src/stream/ngx_stream_limit_conn_module.o \ objs/src/stream/ngx_stream_access_module.o \ objs/src/stream/ngx_stream_geo_module.o \ objs/src/stream/ngx_stream_map_module.o \ objs/src/stream/ngx_stream_split_clients_module.o \ objs/src/stream/ngx_stream_return_module.o \ objs/src/stream/ngx_stream_upstream_hash_module.o \ objs/src/stream/ngx_stream_upstream_least_conn_module.o \ objs/src/stream/ngx_stream_upstream_zone_module.o \ objs/ngx_modules.o \ -ldl -lpthread -lcrypt -lpcre -lssl -lcrypto -ldl -lpthread -lz \ -Wl,-E sed -e "s|%%PREFIX%%|/yinzhengjie/softwares/nginx|" \ -e "s|%%PID_PATH%%|/yinzhengjie/softwares/nginx/logs/nginx.pid|" \ -e "s|%%CONF_PATH%%|/yinzhengjie/softwares/nginx/conf/nginx.conf|" \ -e "s|%%ERROR_LOG_PATH%%|/yinzhengjie/softwares/nginx/logs/error.log|" \ < man/nginx.8 > objs/nginx.8 make[1]: Leaving directory `/usr/local/src/nginx-1.14.2' [[email protected] /usr/local/src/nginx-1.14.2]# [[email protected] /usr/local/src/nginx-1.14.2]# echo $? 0 [[email protected] /usr/local/src/nginx-1.14.2]#
7>.安装(该步骤会创建目录,并将生成的模块和文件复制到相应的目录)
[[email protected] /usr/local/src/nginx-1.14.2]# make install make -f objs/Makefile install make[1]: Entering directory `/usr/local/src/nginx-1.14.2' test -d '/yinzhengjie/softwares/nginx' || mkdir -p '/yinzhengjie/softwares/nginx' test -d '/yinzhengjie/softwares/nginx/sbin' \ || mkdir -p '/yinzhengjie/softwares/nginx/sbin' test ! -f '/yinzhengjie/softwares/nginx/sbin/nginx' \ || mv '/yinzhengjie/softwares/nginx/sbin/nginx' \ '/yinzhengjie/softwares/nginx/sbin/nginx.old' cp objs/nginx '/yinzhengjie/softwares/nginx/sbin/nginx' test -d '/yinzhengjie/softwares/nginx/conf' \ || mkdir -p '/yinzhengjie/softwares/nginx/conf' cp conf/koi-win '/yinzhengjie/softwares/nginx/conf' cp conf/koi-utf '/yinzhengjie/softwares/nginx/conf' cp conf/win-utf '/yinzhengjie/softwares/nginx/conf' test -f '/yinzhengjie/softwares/nginx/conf/mime.types' \ || cp conf/mime.types '/yinzhengjie/softwares/nginx/conf' cp conf/mime.types '/yinzhengjie/softwares/nginx/conf/mime.types.default' test -f '/yinzhengjie/softwares/nginx/conf/fastcgi_params' \ || cp conf/fastcgi_params '/yinzhengjie/softwares/nginx/conf' cp conf/fastcgi_params \ '/yinzhengjie/softwares/nginx/conf/fastcgi_params.default' test -f '/yinzhengjie/softwares/nginx/conf/fastcgi.conf' \ || cp conf/fastcgi.conf '/yinzhengjie/softwares/nginx/conf' cp conf/fastcgi.conf '/yinzhengjie/softwares/nginx/conf/fastcgi.conf.default' test -f '/yinzhengjie/softwares/nginx/conf/uwsgi_params' \ || cp conf/uwsgi_params '/yinzhengjie/softwares/nginx/conf' cp conf/uwsgi_params \ '/yinzhengjie/softwares/nginx/conf/uwsgi_params.default' test -f '/yinzhengjie/softwares/nginx/conf/scgi_params' \ || cp conf/scgi_params '/yinzhengjie/softwares/nginx/conf' cp conf/scgi_params \ '/yinzhengjie/softwares/nginx/conf/scgi_params.default' test -f '/yinzhengjie/softwares/nginx/conf/nginx.conf' \ || cp conf/nginx.conf '/yinzhengjie/softwares/nginx/conf/nginx.conf' cp conf/nginx.conf '/yinzhengjie/softwares/nginx/conf/nginx.conf.default' test -d '/yinzhengjie/softwares/nginx/logs' \ || mkdir -p '/yinzhengjie/softwares/nginx/logs' test -d '/yinzhengjie/softwares/nginx/logs' \ || mkdir -p '/yinzhengjie/softwares/nginx/logs' test -d '/yinzhengjie/softwares/nginx/html' \ || cp -R html '/yinzhengjie/softwares/nginx' test -d '/yinzhengjie/softwares/nginx/logs' \ || mkdir -p '/yinzhengjie/softwares/nginx/logs' make[1]: Leaving directory `/usr/local/src/nginx-1.14.2' [[email protected] /usr/local/src/nginx-1.14.2]# [[email protected] /usr/local/src/nginx-1.14.2]# echo $? 0 [[email protected] /usr/local/src/nginx-1.14.2]# [[email protected] /usr/local/src/nginx-1.14.2]#
[[email protected] /usr/local/src/nginx-1.14.2]# ll /yinzhengjie/softwares/nginx/ total 0 drwxr-xr-x 2 root root 333 Dec 15 13:56 conf #保存nginx所有的配置文件,其中nginx.conf是nginx服务器的最核心最主要的配置文件,其他的.conf则是用来配置nginx相关的功能的,例如fastcgi功能使用的是fastcgi.conf和fastcgi_params两个文件,配置文件一般都有个样板配置文件,是文件名.default结尾,使用的使用将其复制为并将default去掉即可。 drwxr-xr-x 2 root root 40 Dec 15 13:56 html #保存了nginx服务器的web文件,但是可以更改为其他目录保存web文件,另外还有一个50x的web文件是默认的错误页面提示页面 drwxr-xr-x 2 root root 6 Dec 15 13:56 logs #用来保存nginx服务器的访问日志错误日志等日志,logs目录可以放在其他路径,比如/var/logs/nginx里面。 drwxr-xr-x 2 root root 19 Dec 15 13:56 sbin #保存nginx二进制启动脚本,可以接受不同的参数以实现不同的功能。 [[email protected] /usr/local/src/nginx-1.14.2]#
8>.创建nginx并授权
[[email protected] ~]# [[email protected] ~]# useradd nginx -s /sbin/nologin -u 2000 [[email protected] ~]# [[email protected] ~]# chown nginx:nginx -R /yinzhengjie/softwares/nginx/ [[email protected] ~]#
9>.启动nginx服务
[[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:111 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# /yinzhengjie/softwares/nginx/sbin/nginx -t nginx: the configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf syntax is ok nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test is successful [[email protected] ~]# [[email protected] ~]# /yinzhengjie/softwares/nginx/sbin/nginx #启动nginx程序成功后,可以通过web界面访问 [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:111 *:* LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]#
10>.CentOS 7.6编写nginx启动脚本
[[email protected] ~]# vim /usr/lib/systemd/system/nginx.service [[email protected] ~]# [[email protected] ~]# cat /usr/lib/systemd/system/nginx.service [Unit] Description=YinZhengJie's nginx - high performance web server Documentation=http://nginx.org/en/docs/ After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/yinzhengjie/softwares/nginx/logs/nginx.pid ExecStart=/yinzhengjie/softwares/nginx/sbin/nginx -c /yinzhengjie/softwares/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID [Install] WantedBy=multi-user.target [[email protected] ~]#
[[email protected] ~]# systemctl status nginx.service ● nginx.service - YinZhengJie's nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: http://nginx.org/en/docs/ Dec 15 15:17:12 node101.yinzhengjie.org.cn systemd[1]: Unit nginx.service cannot be reloaded because it is inactive. Dec 15 15:20:21 node101.yinzhengjie.org.cn systemd[1]: Starting YinZhengJie's nginx - high performance web server... Dec 15 15:20:21 node101.yinzhengjie.org.cn systemd[1]: Started YinZhengJie's nginx - high performance web server. Dec 15 15:20:28 node101.yinzhengjie.org.cn systemd[1]: Stopping YinZhengJie's nginx - high performance web server... Dec 15 15:20:28 node101.yinzhengjie.org.cn systemd[1]: Stopped YinZhengJie's nginx - high performance web server. [[email protected] ~]# [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# systemctl start nginx.service #启动nginx服务 [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# systemctl status nginx.service ● nginx.service - YinZhengJie's nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Sun 2019-12-15 15:26:19 CST; 4s ago Docs: http://nginx.org/en/docs/ Process: 12749 ExecStart=/yinzhengjie/softwares/nginx/sbin/nginx -c /yinzhengjie/softwares/nginx/conf/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 12750 (nginx) CGroup: /system.slice/nginx.service ├─12750 nginx: master process /yinzhengjie/softwares/nginx/sbin/nginx -c /yinzhengjie/softwares/nginx/conf/nginx.conf └─12751 nginx: worker process Dec 15 15:26:19 node101.yinzhengjie.org.cn systemd[1]: Starting YinZhengJie's nginx - high performance web server... Dec 15 15:26:19 node101.yinzhengjie.org.cn systemd[1]: Started YinZhengJie's nginx - high performance web server. [[email protected] ~]# [[email protected] ~]#
[[email protected] ~]# systemctl status nginx.service ● nginx.service - YinZhengJie's nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Sun 2019-12-15 15:26:19 CST; 48s ago Docs: http://nginx.org/en/docs/ Process: 12749 ExecStart=/yinzhengjie/softwares/nginx/sbin/nginx -c /yinzhengjie/softwares/nginx/conf/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 12750 (nginx) CGroup: /system.slice/nginx.service ├─12750 nginx: master process /yinzhengjie/softwares/nginx/sbin/nginx -c /yinzhengjie/softwares/nginx/conf/nginx.conf └─12751 nginx: worker process Dec 15 15:26:19 node101.yinzhengjie.org.cn systemd[1]: Starting YinZhengJie's nginx - high performance web server... Dec 15 15:26:19 node101.yinzhengjie.org.cn systemd[1]: Started YinZhengJie's nginx - high performance web server. [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# systemctl stop nginx.service #停止nginx服务 [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# systemctl status nginx.service ● nginx.service - YinZhengJie's nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: http://nginx.org/en/docs/ Dec 15 15:17:12 node101.yinzhengjie.org.cn systemd[1]: Unit nginx.service cannot be reloaded because it is inactive. Dec 15 15:20:21 node101.yinzhengjie.org.cn systemd[1]: Starting YinZhengJie's nginx - high performance web server... Dec 15 15:20:21 node101.yinzhengjie.org.cn systemd[1]: Started YinZhengJie's nginx - high performance web server. Dec 15 15:20:28 node101.yinzhengjie.org.cn systemd[1]: Stopping YinZhengJie's nginx - high performance web server... Dec 15 15:20:28 node101.yinzhengjie.org.cn systemd[1]: Stopped YinZhengJie's nginx - high performance web server. Dec 15 15:26:19 node101.yinzhengjie.org.cn systemd[1]: Starting YinZhengJie's nginx - high performance web server... Dec 15 15:26:19 node101.yinzhengjie.org.cn systemd[1]: Started YinZhengJie's nginx - high performance web server. Dec 15 15:27:16 node101.yinzhengjie.org.cn systemd[1]: Stopping YinZhengJie's nginx - high performance web server... Dec 15 15:27:16 node101.yinzhengjie.org.cn systemd[1]: Stopped YinZhengJie's nginx - high performance web server. [[email protected] ~]#
[[email protected] ~]# systemctl status nginx.service ● nginx.service - YinZhengJie's nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Sun 2019-12-15 15:29:52 CST; 11s ago Docs: http://nginx.org/en/docs/ Process: 12774 ExecStart=/yinzhengjie/softwares/nginx/sbin/nginx -c /yinzhengjie/softwares/nginx/conf/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 12775 (nginx) CGroup: /system.slice/nginx.service ├─12775 nginx: master process /yinzhengjie/softwares/nginx/sbin/nginx -c /yinzhengjie/softwares/nginx/conf/nginx.conf └─12776 nginx: worker process Dec 15 15:29:52 node101.yinzhengjie.org.cn systemd[1]: Starting YinZhengJie's nginx - high performance web server... Dec 15 15:29:52 node101.yinzhengjie.org.cn systemd[1]: Started YinZhengJie's nginx - high performance web server. [[email protected] ~]# [[email protected] ~]# ps -ef | grep nginx root 12775 1 0 15:29 ? 00:00:00 nginx: master process /yinzhengjie/softwares/nginx/sbin/nginx -c /yinzhengjie/softwares/nginx/conf/nginx.conf nginx 12776 12775 0 15:29 ? 00:00:00 nginx: worker process root 12782 12129 0 15:30 pts/0 00:00:00 grep --color=auto nginx [[email protected] ~]# [[email protected] ~]# systemctl reload nginx #重新加载nginx的配置文件,此时nginx的master进程不会消亡,而是worker生成了新的worker进程,之前的worker进程处理完现有的进程后会自动消亡。 [[email protected] ~]# [[email protected] ~]# ps -ef | grep nginx root 12775 1 0 15:29 ? 00:00:00 nginx: master process /yinzhengjie/softwares/nginx/sbin/nginx -c /yinzhengjie/softwares/nginx/conf/nginx.conf nginx 12790 12775 0 15:30 ? 00:00:00 nginx: worker process root 12792 12129 0 15:30 pts/0 00:00:00 grep --color=auto nginx [[email protected] ~]# [[email protected] ~]#
11>.推荐手动管理nginx服务(通常情况下,我们可能不喜欢使用centos自带的命令去管理nginx,因为敲得命令比较长呗~我们会更乐意给nginx创建一个软连接进行管理)
[[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# ln -sv /yinzhengjie/softwares/nginx/sbin/nginx /usr/sbin/ #是不是上面介绍直接使用centos7的systemctl命令管理nginx敲击命令太长了?因此生产环境中我更喜欢创建一个软连接。 ‘/usr/sbin/nginx’ -> ‘/yinzhengjie/softwares/nginx/sbin/nginx’ [[email protected] ~]# [[email protected] ~]# nginx -t nginx: the configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf syntax is ok nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test is successful [[email protected] ~]# [[email protected] ~]# nginx -s stop [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]#
四.nginx命令常用参数介绍
1>.查看帮助信息
[[email protected] ~]# nginx -h nginx version: nginx/1.16.1 Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives] Options: -?,-h : this help -v : show version and exit -V : show version and configure options then exit -t : test configuration and exit -T : test configuration, dump it and exit -q : suppress non-error messages during configuration testing -s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: /etc/nginx/) -c filename : set configuration file (default: /etc/nginx/nginx.conf) -g directives : set global directives out of configuration file [[email protected] ~]#
2>."-v"参数使用案例
[[email protected] ~]# nginx -v #查看nginx的版本简要信息 nginx version: nginx/1.16.1 [[email protected] ~]#
3>."-V"参数使用案例
[[email protected] ~]# nginx -V #会列出nginx版本以及配置选项,升级安装时,我们得参考这些配置选项,升级时别忘记把列出的所有参数都带上,这样升级也做到了向下兼容。 nginx version: nginx/1.16.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/ngi nx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' [[email protected] ~]#
4>."-t"参数使用案例
[[email protected] ~]# nginx -t #检查nginx的配置文件语法是否正确 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [[email protected] ~]#
5>."-T"参数使用案例
[[email protected] ~]# nginx -T #检查mnginx的配置文件语法是否正确并列出生效的文件内容 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful # configuration file /etc/nginx/nginx.conf: user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; } # configuration file /etc/nginx/mime.types: types { text/html html htm shtml; text/css css; text/xml xml; image/gif gif; image/jpeg jpeg jpg; application/javascript js; application/atom+xml atom; application/rss+xml rss; text/mathml mml; text/plain txt; text/vnd.sun.j2me.app-descriptor jad; text/vnd.wap.wml wml; text/x-component htc; image/png png; image/svg+xml svg svgz; image/tiff tif tiff; image/vnd.wap.wbmp wbmp; image/webp webp; image/x-icon ico; image/x-jng jng; image/x-ms-bmp bmp; font/woff woff; font/woff2 woff2; application/java-archive jar war ear; application/json json; application/mac-binhex40 hqx; application/msword doc; application/pdf pdf; application/postscript ps eps ai; application/rtf rtf; application/vnd.apple.mpegurl m3u8; application/vnd.google-earth.kml+xml kml; application/vnd.google-earth.kmz kmz; application/vnd.ms-excel xls; application/vnd.ms-fontobject eot; application/vnd.ms-powerpoint ppt; application/vnd.oasis.opendocument.graphics odg; application/vnd.oasis.opendocument.presentation odp; application/vnd.oasis.opendocument.spreadsheet ods; application/vnd.oasis.opendocument.text odt; application/vnd.openxmlformats-officedocument.presentationml.presentation pptx; application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; application/vnd.openxmlformats-officedocument.wordprocessingml.document docx; application/vnd.wap.wmlc wmlc; application/x-7z-compressed 7z; application/x-cocoa cco; application/x-java-archive-diff jardiff; application/x-java-jnlp-file jnlp; application/x-makeself run; application/x-perl pl pm; application/x-pilot prc pdb; application/x-rar-compressed rar; application/x-redhat-package-manager rpm; application/x-sea sea; application/x-shockwave-flash swf; application/x-stuffit sit; application/x-tcl tcl tk; application/x-x509-ca-cert der pem crt; application/x-xpinstall xpi; application/xhtml+xml xhtml; application/xspf+xml xspf; application/zip zip; application/octet-stream bin exe dll; application/octet-stream deb; application/octet-stream dmg; application/octet-stream iso img; application/octet-stream msi msp msm; audio/midi mid midi kar; audio/mpeg mp3; audio/ogg ogg; audio/x-m4a m4a; audio/x-realaudio ra; video/3gpp 3gpp 3gp; video/mp2t ts; video/mp4 mp4; video/mpeg mpeg mpg; video/quicktime mov; video/webm webm; video/x-flv flv; video/x-m4v m4v; video/x-mng mng; video/x-ms-asf asx asf; video/x-ms-wmv wmv; video/x-msvideo avi; } # configuration file /etc/nginx/conf.d/default.conf: server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } [[email protected] ~]#
6>."-q"参数使用案例
[[email protected] ~]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# nginx -q #在配置测试期间禁止显示非错误消息,也就是说如果没有输出就没有错误,即没有输出就是最好的结果啦~ [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# [[email protected] ~]# nginx -q #第一次执行时若配置文件无问题,则会启用nginx服务,但第二次在执行的话,又一次启动nginx服务会导致地址的端口冲突的,因此会抛出端口被占用的错误提示哟,错误提示如下所示。 nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] still could not bind() [[email protected] ~]#
7>."-s"参数使用案例
[[email protected] ~]# nginx -h nginx version: nginx/1.16.1 Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives] Options: -?,-h : this help -v : show version and exit -V : show version and configure options then exit -t : test configuration and exit -T : test configuration, dump it and exit -q : suppress non-error messages during configuration testing -s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: /etc/nginx/) -c filename : set configuration file (default: /etc/nginx/nginx.conf) -g directives : set global directives out of configuration file [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# nginx [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# nginx -s stop #停止nginx服务 [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]#
8>."-c"参数使用案例
[[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]# nginx -c /etc/nginx/nginx.conf #指定nginx的配置文件启动 [[email protected] ~]# [[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::* [[email protected] ~]# [[email protected] ~]#
五.Nginx默认配置文件参数说明
博主推荐阅读: https://www.cnblogs.com/yinzhengjie/p/12032229.html