Nginx在CENTOS7的安装与使用

很简单的安装与使用。通篇YUM。偷笑

[root@centos7 ~]# yum install gcc automake autoconf libtool make
Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                     | 3.6 kB     00:00     
epel/x86_64/metalink                                     | 7.2 kB     00:00     
epel                                                     | 3.2 kB     00:00     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
zabbix                                                   | 2.9 kB     00:00     
zabbix-non-supported                                     |  951 B     00:00     
(1/4): epel/x86_64/updateinfo                              | 925 kB   00:00     
epel/x86_64/primary            FAILED                                           
http://del-repos.extreme-ix.org/epel/7/x86_64/repodata/0093d7765a1775c2b2bd0d87e8f268c6e3a5e1557c7ffc3db6a6a64a9ab1136a-primary.xml.gz: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

(2/4): updates/7/x86_64/primary_db                         | 2.7 MB   00:01     
(3/4): epel/x86_64/primary                                 | 3.5 MB   00:00     
(4/4): zabbix/x86_64/primary_db                            |  93 kB   00:02     
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
epel                                                                12607/12607
Resolving Dependencies
--> Running transaction check
---> Package autoconf.noarch 0:2.69-11.el7 will be installed
--> Processing Dependency: m4 >= 1.4.14 for package: autoconf-2.69-11.el7.noarch
---> Package automake.noarch 0:1.13.4-3.el7 will be installed
--> Processing Dependency: perl(Thread::Queue) for package: automake-1.13.4-3.el7.noarch
--> Processing Dependency: perl(TAP::Parser) for package: automake-1.13.4-3.el7.noarch
---> Package gcc.x86_64 0:4.8.5-28.el7_5.1 will be installed
--> Processing Dependency: libgomp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: cpp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libgcc >= 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
---> Package libtool.x86_64 0:2.4.2-22.el7_3 will be installed
---> Package make.x86_64 1:3.82-21.el7 will be updated
---> Package make.x86_64 1:3.82-23.el7 will be an update
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-28.el7_5.1 will be installed
---> Package glibc-devel.x86_64 0:2.17-222.el7 will be installed
--> Processing Dependency: glibc-headers = 2.17-222.el7 for package: glibc-devel-2.17-222.el7.x86_64
--> Processing Dependency: glibc = 2.17-222.el7 for package: glibc-devel-2.17-222.el7.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-222.el7.x86_64
---> Package libgcc.x86_64 0:4.8.5-4.el7 will be updated
---> Package libgcc.x86_64 0:4.8.5-28.el7_5.1 will be an update
---> Package libgomp.x86_64 0:4.8.5-4.el7 will be updated
---> Package libgomp.x86_64 0:4.8.5-28.el7_5.1 will be an update
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package m4.x86_64 0:1.4.16-10.el7 will be installed
---> Package perl-Test-Harness.noarch 0:3.28-3.el7 will be installed
---> Package perl-Thread-Queue.noarch 0:3.02-2.el7 will be installed
--> Running transaction check
---> Package glibc.x86_64 0:2.17-105.el7 will be updated
--> Processing Dependency: glibc = 2.17-105.el7 for package: glibc-common-2.17-105.el7.x86_64
---> Package glibc.x86_64 0:2.17-222.el7 will be an update
---> Package glibc-headers.x86_64 0:2.17-222.el7 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-222.el7.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-222.el7.x86_64
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-105.el7 will be updated
---> Package glibc-common.x86_64 0:2.17-222.el7 will be an update
---> Package kernel-headers.x86_64 0:3.10.0-862.3.3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                Arch        Version                  Repository    Size
================================================================================
Installing:
 autoconf               noarch      2.69-11.el7              base         701 k
 automake               noarch      1.13.4-3.el7             base         679 k
 gcc                    x86_64      4.8.5-28.el7_5.1         updates       16 M
 libtool                x86_64      2.4.2-22.el7_3           base         588 k
Updating:
 make                   x86_64      1:3.82-23.el7            base         420 k
Installing for dependencies:
 cpp                    x86_64      4.8.5-28.el7_5.1         updates      5.9 M
 glibc-devel            x86_64      2.17-222.el7             base         1.1 M
 glibc-headers          x86_64      2.17-222.el7             base         678 k
 kernel-headers         x86_64      3.10.0-862.3.3.el7       updates      7.1 M
 libmpc                 x86_64      1.0.1-3.el7              base          51 k
 m4                     x86_64      1.4.16-10.el7            base         256 k
 perl-Test-Harness      noarch      3.28-3.el7               base         302 k
 perl-Thread-Queue      noarch      3.02-2.el7               base          17 k
Updating for dependencies:
 glibc                  x86_64      2.17-222.el7             base         3.6 M
 glibc-common           x86_64      2.17-222.el7             base          11 M
 libgcc                 x86_64      4.8.5-28.el7_5.1         updates      101 k
 libgomp                x86_64      4.8.5-28.el7_5.1         updates      156 k

Transaction Summary
================================================================================
Install  4 Packages (+8 Dependent packages)
Upgrade  1 Package  (+4 Dependent packages)

Total size: 49 M
Total download size: 49 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
Not downloading deltainfo for updates, MD is 259 k and rpms are 257 k
(1/16): automake-1.13.4-3.el7.noarch.rpm                                                                                       | 679 kB  00:00:00     
(2/16): autoconf-2.69-11.el7.noarch.rpm                                                                                        | 701 kB  00:00:00     
(3/16): cpp-4.8.5-28.el7_5.1.x86_64.rpm                                                                                        | 5.9 MB  00:00:13     
(4/16): glibc-2.17-222.el7.x86_64.rpm                                                                                          | 3.6 MB  00:00:14     
(5/16): glibc-headers-2.17-222.el7.x86_64.rpm                                                                                  | 678 kB  00:00:01     
(6/16): libgcc-4.8.5-28.el7_5.1.x86_64.rpm                                                                                     | 101 kB  00:00:00     
(7/16): libgomp-4.8.5-28.el7_5.1.x86_64.rpm                                                                                    | 156 kB  00:00:01     
(8/16): libmpc-1.0.1-3.el7.x86_64.rpm                                                                                          |  51 kB  00:00:00     
(9/16): libtool-2.4.2-22.el7_3.x86_64.rpm                                                                                      | 588 kB  00:00:00     
(10/16): glibc-devel-2.17-222.el7.x86_64.rpm                                                                                   | 1.1 MB  00:00:03     
(11/16): m4-1.4.16-10.el7.x86_64.rpm                                                                                           | 256 kB  00:00:00     
(12/16): perl-Thread-Queue-3.02-2.el7.noarch.rpm                                                                               |  17 kB  00:00:00     
(13/16): perl-Test-Harness-3.28-3.el7.noarch.rpm                                                                               | 302 kB  00:00:00     
(14/16): kernel-headers-3.10.0-862.3.3.el7.x86_64.rpm                                                                          | 7.1 MB  00:00:08     
(15/16): gcc-4.8.5-28.el7_5.1.x86_64.rpm                                                                                       |  16 MB  00:00:24     
(16/16): glibc-common-2.17-222.el7.x86_64.rpm                                                                                  |  11 MB  00:00:24     
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 2.0 MB/s |  49 MB  00:00:24     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libgcc-4.8.5-28.el7_5.1.x86_64                                                                                                    1/22 
  Updating   : glibc-common-2.17-222.el7.x86_64                                                                                                  2/22 
  Updating   : glibc-2.17-222.el7.x86_64                                                                                                         3/22 
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
  Installing : libmpc-1.0.1-3.el7.x86_64                                                                                                         4/22 
  Installing : cpp-4.8.5-28.el7_5.1.x86_64                                                                                                       5/22 
  Installing : m4-1.4.16-10.el7.x86_64                                                                                                           6/22 
  Installing : autoconf-2.69-11.el7.noarch                                                                                                       7/22 
  Updating   : libgomp-4.8.5-28.el7_5.1.x86_64                                                                                                   8/22 
  Installing : perl-Test-Harness-3.28-3.el7.noarch                                                                                               9/22 
  Installing : perl-Thread-Queue-3.02-2.el7.noarch                                                                                              10/22 
  Installing : automake-1.13.4-3.el7.noarch                                                                                                     11/22 
  Installing : kernel-headers-3.10.0-862.3.3.el7.x86_64                                                                                         12/22 
  Installing : glibc-headers-2.17-222.el7.x86_64                                                                                                13/22 
  Installing : glibc-devel-2.17-222.el7.x86_64                                                                                                  14/22 
  Installing : gcc-4.8.5-28.el7_5.1.x86_64                                                                                                      15/22 
  Installing : libtool-2.4.2-22.el7_3.x86_64                                                                                                    16/22 
  Updating   : 1:make-3.82-23.el7.x86_64                                                                                                        17/22 
  Cleanup    : 1:make-3.82-21.el7.x86_64                                                                                                        18/22 
  Cleanup    : libgomp-4.8.5-4.el7.x86_64                                                                                                       19/22 
  Cleanup    : glibc-common-2.17-105.el7.x86_64                                                                                                 20/22 
  Cleanup    : glibc-2.17-105.el7.x86_64                                                                                                        21/22 
  Cleanup    : libgcc-4.8.5-4.el7.x86_64                                                                                                        22/22 
  Verifying  : glibc-devel-2.17-222.el7.x86_64                                                                                                   1/22 
  Verifying  : glibc-headers-2.17-222.el7.x86_64                                                                                                 2/22 
  Verifying  : automake-1.13.4-3.el7.noarch                                                                                                      3/22 
  Verifying  : m4-1.4.16-10.el7.x86_64                                                                                                           4/22 
  Verifying  : libgomp-4.8.5-28.el7_5.1.x86_64                                                                                                   5/22 
  Verifying  : kernel-headers-3.10.0-862.3.3.el7.x86_64                                                                                          6/22 
  Verifying  : gcc-4.8.5-28.el7_5.1.x86_64                                                                                                       7/22 
  Verifying  : perl-Thread-Queue-3.02-2.el7.noarch                                                                                               8/22 
  Verifying  : glibc-2.17-222.el7.x86_64                                                                                                         9/22 
  Verifying  : libtool-2.4.2-22.el7_3.x86_64                                                                                                    10/22 
  Verifying  : libgcc-4.8.5-28.el7_5.1.x86_64                                                                                                   11/22 
  Verifying  : cpp-4.8.5-28.el7_5.1.x86_64                                                                                                      12/22 
  Verifying  : 1:make-3.82-23.el7.x86_64                                                                                                        13/22 
  Verifying  : libmpc-1.0.1-3.el7.x86_64                                                                                                        14/22 
  Verifying  : glibc-common-2.17-222.el7.x86_64                                                                                                 15/22 
  Verifying  : autoconf-2.69-11.el7.noarch                                                                                                      16/22 
  Verifying  : perl-Test-Harness-3.28-3.el7.noarch                                                                                              17/22 
  Verifying  : glibc-common-2.17-105.el7.x86_64                                                                                                 18/22 
  Verifying  : glibc-2.17-105.el7.x86_64                                                                                                        19/22 
  Verifying  : libgomp-4.8.5-4.el7.x86_64                                                                                                       20/22 
  Verifying  : libgcc-4.8.5-4.el7.x86_64                                                                                                        21/22 
  Verifying  : 1:make-3.82-21.el7.x86_64                                                                                                        22/22 

Installed:
  autoconf.noarch 0:2.69-11.el7       automake.noarch 0:1.13.4-3.el7       gcc.x86_64 0:4.8.5-28.el7_5.1       libtool.x86_64 0:2.4.2-22.el7_3      

Dependency Installed:
  cpp.x86_64 0:4.8.5-28.el7_5.1  glibc-devel.x86_64 0:2.17-222.el7  glibc-headers.x86_64 0:2.17-222.el7    kernel-headers.x86_64 0:3.10.0-862.3.3.el7 
  libmpc.x86_64 0:1.0.1-3.el7    m4.x86_64 0:1.4.16-10.el7          perl-Test-Harness.noarch 0:3.28-3.el7  perl-Thread-Queue.noarch 0:3.02-2.el7      

Updated:
  make.x86_64 1:3.82-23.el7                                                                                                                           

Dependency Updated:
  glibc.x86_64 0:2.17-222.el7     glibc-common.x86_64 0:2.17-222.el7     libgcc.x86_64 0:4.8.5-28.el7_5.1     libgomp.x86_64 0:4.8.5-28.el7_5.1    

Complete!
[root@centos7 ~]# yum install gcc gcc-c++
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
Package gcc-4.8.5-28.el7_5.1.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 0:4.8.5-28.el7_5.1 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-28.el7_5.1 for package: gcc-c++-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libstdc++ = 4.8.5-28.el7_5.1 for package: gcc-c++-4.8.5-28.el7_5.1.x86_64
--> Running transaction check
---> Package libstdc++.x86_64 0:4.8.5-4.el7 will be updated
---> Package libstdc++.x86_64 0:4.8.5-28.el7_5.1 will be an update
---> Package libstdc++-devel.x86_64 0:4.8.5-28.el7_5.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                                Arch                          Version                                    Repository                      Size
======================================================================================================================================================
Installing:
 gcc-c++                                x86_64                        4.8.5-28.el7_5.1                           updates                        7.2 M
Installing for dependencies:
 libstdc++-devel                        x86_64                        4.8.5-28.el7_5.1                           updates                        1.5 M
Updating for dependencies:
 libstdc++                              x86_64                        4.8.5-28.el7_5.1                           updates                        303 k

Transaction Summary
======================================================================================================================================================
Install  1 Package  (+1 Dependent package)
Upgrade             ( 1 Dependent package)

Total download size: 9.0 M
Is this ok [y/d/N]: y
Downloading packages:
updates/7/x86_64/prestodelta                                                                                                   | 259 kB  00:00:00     
Delta RPMs reduced 303 k of updates to 69 k (77% saved)
(1/3): libstdc++-4.8.5-16.el7_4.2_4.8.5-28.el7_5.1.x86_64.drpm                                                                 |  69 kB  00:00:00     
(2/3): libstdc++-devel-4.8.5-28.el7_5.1.x86_64.rpm                                                                             | 1.5 MB  00:00:00     
(3/3): gcc-c++-4.8.5-28.el7_5.1.x86_64.rpm                                                                                     | 7.2 MB  00:00:03     
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 2.6 MB/s | 8.7 MB  00:00:03     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libstdc++-4.8.5-28.el7_5.1.x86_64                                                                                                  1/4 
  Installing : libstdc++-devel-4.8.5-28.el7_5.1.x86_64                                                                                            2/4 
  Installing : gcc-c++-4.8.5-28.el7_5.1.x86_64                                                                                                    3/4 
  Cleanup    : libstdc++-4.8.5-4.el7.x86_64                                                                                                       4/4 
  Verifying  : libstdc++-devel-4.8.5-28.el7_5.1.x86_64                                                                                            1/4 
  Verifying  : libstdc++-4.8.5-28.el7_5.1.x86_64                                                                                                  2/4 
  Verifying  : gcc-c++-4.8.5-28.el7_5.1.x86_64                                                                                                    3/4 
  Verifying  : libstdc++-4.8.5-4.el7.x86_64                                                                                                       4/4 

Installed:
  gcc-c++.x86_64 0:4.8.5-28.el7_5.1                                                                                                                   

Dependency Installed:
  libstdc++-devel.x86_64 0:4.8.5-28.el7_5.1                                                                                                           

Dependency Updated:
  libstdc++.x86_64 0:4.8.5-28.el7_5.1                                                                                                                 

Complete!

[root@centos7 src]# yum install pcre
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package pcre.x86_64 0:8.32-15.el7 will be updated
---> Package pcre.x86_64 0:8.32-17.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                          Arch                               Version                                   Repository                        Size
======================================================================================================================================================
Updating:
 pcre                             x86_64                             8.32-17.el7                               base                             422 k

Transaction Summary
======================================================================================================================================================
Upgrade  1 Package

Total size: 422 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : pcre-8.32-17.el7.x86_64                                                                                                            1/2 
  Cleanup    : pcre-8.32-15.el7.x86_64                                                                                                            2/2 
  Verifying  : pcre-8.32-17.el7.x86_64                                                                                                            1/2 
  Verifying  : pcre-8.32-15.el7.x86_64                                                                                                            2/2 

Updated:
  pcre.x86_64 0:8.32-17.el7                                                                                                                           

Complete!
[root@centos7 src]# yum install zlib
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package zlib.x86_64 0:1.2.7-15.el7 will be updated
---> Package zlib.x86_64 0:1.2.7-17.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                          Arch                               Version                                   Repository                        Size
======================================================================================================================================================
Updating:
 zlib                             x86_64                             1.2.7-17.el7                              base                              90 k

Transaction Summary
======================================================================================================================================================
Upgrade  1 Package

Total size: 90 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : zlib-1.2.7-17.el7.x86_64                                                                                                           1/2 
  Cleanup    : zlib-1.2.7-15.el7.x86_64                                                                                                           2/2 
  Verifying  : zlib-1.2.7-17.el7.x86_64                                                                                                           1/2 
  Verifying  : zlib-1.2.7-15.el7.x86_64                                                                                                           2/2 

Updated:
  zlib.x86_64 0:1.2.7-17.el7                                                                                                                          

Complete!
[root@centos7 src]# yum install openssl
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package openssl.x86_64 1:1.0.2k-8.el7 will be updated
---> Package openssl.x86_64 1:1.0.2k-12.el7 will be an update
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-12.el7 for package: 1:openssl-1.0.2k-12.el7.x86_64
--> Running transaction check
---> Package openssl-libs.x86_64 1:1.0.2k-8.el7 will be updated
---> Package openssl-libs.x86_64 1:1.0.2k-12.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                               Arch                            Version                                    Repository                     Size
======================================================================================================================================================
Updating:
 openssl                               x86_64                          1:1.0.2k-12.el7                            base                          492 k
Updating for dependencies:
 openssl-libs                          x86_64                          1:1.0.2k-12.el7                            base                          1.2 M

Transaction Summary
======================================================================================================================================================
Upgrade  1 Package (+1 Dependent package)

Total download size: 1.7 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
(1/2): openssl-1.0.2k-12.el7.x86_64.rpm                                                                                        | 492 kB  00:00:00     
(2/2): openssl-libs-1.0.2k-12.el7.x86_64.rpm                                                                                   | 1.2 MB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 6.5 MB/s | 1.7 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:openssl-libs-1.0.2k-12.el7.x86_64                                                                                                1/4 
  Updating   : 1:openssl-1.0.2k-12.el7.x86_64                                                                                                     2/4 
  Cleanup    : 1:openssl-1.0.2k-8.el7.x86_64                                                                                                      3/4 
  Cleanup    : 1:openssl-libs-1.0.2k-8.el7.x86_64                                                                                                 4/4 
  Verifying  : 1:openssl-libs-1.0.2k-12.el7.x86_64                                                                                                1/4 
  Verifying  : 1:openssl-1.0.2k-12.el7.x86_64                                                                                                     2/4 
  Verifying  : 1:openssl-1.0.2k-8.el7.x86_64                                                                                                      3/4 
  Verifying  : 1:openssl-libs-1.0.2k-8.el7.x86_64                                                                                                 4/4 

Updated:
  openssl.x86_64 1:1.0.2k-12.el7                                                                                                                      

Dependency Updated:
  openssl-libs.x86_64 1:1.0.2k-12.el7                                                                                                                 

Complete!

[root@centos7 src]# yum install nginx
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.12.2-2.el7 will be installed
--> Processing Dependency: nginx-filesystem = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64
--> Processing Dependency: nginx-all-modules = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64
--> Processing Dependency: nginx-filesystem for package: 1:nginx-1.12.2-2.el7.x86_64
--> Running transaction check
---> Package nginx-all-modules.noarch 1:1.12.2-2.el7 will be installed
--> Processing Dependency: nginx-mod-stream = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-mail = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-xslt-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-perl = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-image-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-geoip = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
---> Package nginx-filesystem.noarch 1:1.12.2-2.el7 will be installed
--> Running transaction check
---> Package nginx-mod-http-geoip.x86_64 1:1.12.2-2.el7 will be installed
--> Processing Dependency: GeoIP for package: 1:nginx-mod-http-geoip-1.12.2-2.el7.x86_64
--> Processing Dependency: libGeoIP.so.1()(64bit) for package: 1:nginx-mod-http-geoip-1.12.2-2.el7.x86_64
---> Package nginx-mod-http-image-filter.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-perl.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-xslt-filter.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-mail.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-stream.x86_64 1:1.12.2-2.el7 will be installed
--> Running transaction check
---> Package GeoIP.x86_64 0:1.5.0-11.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                                           Arch                         Version                              Repository                  Size
======================================================================================================================================================
Installing:
 nginx                                             x86_64                       1:1.12.2-2.el7                       epel                       530 k
Installing for dependencies:
 GeoIP                                             x86_64                       1.5.0-11.el7                         base                       1.1 M
 nginx-all-modules                                 noarch                       1:1.12.2-2.el7                       epel                        16 k
 nginx-filesystem                                  noarch                       1:1.12.2-2.el7                       epel                        17 k
 nginx-mod-http-geoip                              x86_64                       1:1.12.2-2.el7                       epel                        23 k
 nginx-mod-http-image-filter                       x86_64                       1:1.12.2-2.el7                       epel                        26 k
 nginx-mod-http-perl                               x86_64                       1:1.12.2-2.el7                       epel                        36 k
 nginx-mod-http-xslt-filter                        x86_64                       1:1.12.2-2.el7                       epel                        26 k
 nginx-mod-mail                                    x86_64                       1:1.12.2-2.el7                       epel                        54 k
 nginx-mod-stream                                  x86_64                       1:1.12.2-2.el7                       epel                        76 k

Transaction Summary
======================================================================================================================================================
Install  1 Package (+9 Dependent packages)

Total size: 1.8 M
Total download size: 805 k
Installed size: 4.6 M
Is this ok [y/d/N]: y
Downloading packages:
(1/9): nginx-1.12.2-2.el7.x86_64.rpm                                                                                           | 530 kB  00:00:00     
(2/9): nginx-all-modules-1.12.2-2.el7.noarch.rpm                                                                               |  16 kB  00:00:00     
(3/9): nginx-filesystem-1.12.2-2.el7.noarch.rpm                                                                                |  17 kB  00:00:00     
(4/9): nginx-mod-http-geoip-1.12.2-2.el7.x86_64.rpm                                                                            |  23 kB  00:00:00     
(5/9): nginx-mod-http-image-filter-1.12.2-2.el7.x86_64.rpm                                                                     |  26 kB  00:00:00     
(6/9): nginx-mod-http-perl-1.12.2-2.el7.x86_64.rpm                                                                             |  36 kB  00:00:00     
(7/9): nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64.rpm                                                                      |  26 kB  00:00:00     
(8/9): nginx-mod-mail-1.12.2-2.el7.x86_64.rpm                                                                                  |  54 kB  00:00:00     
(9/9): nginx-mod-stream-1.12.2-2.el7.x86_64.rpm                                                                                |  76 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 1.3 MB/s | 805 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : GeoIP-1.5.0-11.el7.x86_64                                                                                                         1/10 
  Installing : 1:nginx-filesystem-1.12.2-2.el7.noarch                                                                                            2/10 
  Installing : 1:nginx-mod-http-geoip-1.12.2-2.el7.x86_64                                                                                        3/10 
  Installing : 1:nginx-mod-mail-1.12.2-2.el7.x86_64                                                                                              4/10 
  Installing : 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64                                                                                  5/10 
  Installing : 1:nginx-mod-http-image-filter-1.12.2-2.el7.x86_64                                                                                 6/10 
  Installing : 1:nginx-mod-http-perl-1.12.2-2.el7.x86_64                                                                                         7/10 
  Installing : 1:nginx-all-modules-1.12.2-2.el7.noarch                                                                                           8/10 
  Installing : 1:nginx-1.12.2-2.el7.x86_64                                                                                                       9/10 
  Installing : 1:nginx-mod-stream-1.12.2-2.el7.x86_64                                                                                           10/10 
  Verifying  : 1:nginx-filesystem-1.12.2-2.el7.noarch                                                                                            1/10 
  Verifying  : GeoIP-1.5.0-11.el7.x86_64                                                                                                         2/10 
  Verifying  : 1:nginx-mod-http-geoip-1.12.2-2.el7.x86_64                                                                                        3/10 
  Verifying  : 1:nginx-1.12.2-2.el7.x86_64                                                                                                       4/10 
  Verifying  : 1:nginx-mod-mail-1.12.2-2.el7.x86_64                                                                                              5/10 
  Verifying  : 1:nginx-all-modules-1.12.2-2.el7.noarch                                                                                           6/10 
  Verifying  : 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64                                                                                  7/10 
  Verifying  : 1:nginx-mod-http-image-filter-1.12.2-2.el7.x86_64                                                                                 8/10 
  Verifying  : 1:nginx-mod-http-perl-1.12.2-2.el7.x86_64                                                                                         9/10 
  Verifying  : 1:nginx-mod-stream-1.12.2-2.el7.x86_64                                                                                           10/10 

Installed:
  nginx.x86_64 1:1.12.2-2.el7                                                                                                                         

Dependency Installed:
  GeoIP.x86_64 0:1.5.0-11.el7                        nginx-all-modules.noarch 1:1.12.2-2.el7             nginx-filesystem.noarch 1:1.12.2-2.el7     
  nginx-mod-http-geoip.x86_64 1:1.12.2-2.el7         nginx-mod-http-image-filter.x86_64 1:1.12.2-2.el7   nginx-mod-http-perl.x86_64 1:1.12.2-2.el7  
  nginx-mod-http-xslt-filter.x86_64 1:1.12.2-2.el7   nginx-mod-mail.x86_64 1:1.12.2-2.el7                nginx-mod-stream.x86_64 1:1.12.2-2.el7     

Complete!

安装后无法顺利启动NGINX。

[root@centos7 local]# systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[root@centos7 local]# systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2018-07-03 14:21:37 CST; 13s ago
  Process: 4902 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
  Process: 4899 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 4897 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Jul 03 14:21:36 centos7 nginx[4902]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jul 03 14:21:36 centos7 nginx[4902]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jul 03 14:21:36 centos7 nginx[4902]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jul 03 14:21:37 centos7 nginx[4902]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jul 03 14:21:37 centos7 nginx[4902]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jul 03 14:21:37 centos7 nginx[4902]: nginx: [emerg] still could not bind()
Jul 03 14:21:37 centos7 systemd[1]: nginx.service: control process exited, code=exited status=1
Jul 03 14:21:37 centos7 systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Jul 03 14:21:37 centos7 systemd[1]: Unit nginx.service entered failed state.
Jul 03 14:21:37 centos7 systemd[1]: nginx.service failed.

由于80端口被HTTPD进程占用,导致NGINX启动失败。关闭HTTPD。

[root@centos7 local]# lsof -i:80
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd    926   root    4u  IPv6  19378      0t0  TCP *:http (LISTEN)
httpd   3826 apache    4u  IPv6  19378      0t0  TCP *:http (LISTEN)
httpd   3827 apache    4u  IPv6  19378      0t0  TCP *:http (LISTEN)
httpd   3828 apache    4u  IPv6  19378      0t0  TCP *:http (LISTEN)
httpd   3829 apache    4u  IPv6  19378      0t0  TCP *:http (LISTEN)
httpd   3830 apache    4u  IPv6  19378      0t0  TCP *:http (LISTEN)
[root@centos7 local]# systemctl status httpd.service 
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2018-07-03 13:17:44 CST; 1h 15min ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 926 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─ 926 /usr/sbin/httpd -DFOREGROUND
           ├─3826 /usr/sbin/httpd -DFOREGROUND
           ├─3827 /usr/sbin/httpd -DFOREGROUND
           ├─3828 /usr/sbin/httpd -DFOREGROUND
           ├─3829 /usr/sbin/httpd -DFOREGROUND
           └─3830 /usr/sbin/httpd -DFOREGROUND

Jul 03 13:17:39 centos7 systemd[1]: Starting The Apache HTTP Server...
Jul 03 13:17:43 centos7 httpd[926]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1...s message
Jul 03 13:17:44 centos7 systemd[1]: Started The Apache HTTP Server.
Jul 03 14:16:01 centos7 httpd[3818]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168....s message
Jul 03 14:16:01 centos7 systemd[1]: Reloaded The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@centos7 local]# systemctl stop httpd.service 
[root@centos7 local]# systemctl status httpd.service 
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Tue 2018-07-03 14:33:00 CST; 2s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 5077 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
 Main PID: 926 (code=exited, status=0/SUCCESS)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"

Jul 03 13:17:39 centos7 systemd[1]: Starting The Apache HTTP Server...
Jul 03 13:17:43 centos7 httpd[926]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1...s message
Jul 03 13:17:44 centos7 systemd[1]: Started The Apache HTTP Server.
Jul 03 14:16:01 centos7 httpd[3818]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168....s message
Jul 03 14:16:01 centos7 systemd[1]: Reloaded The Apache HTTP Server.
Jul 03 14:32:59 centos7 systemd[1]: Stopping The Apache HTTP Server...
Jul 03 14:33:00 centos7 systemd[1]: Stopped The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@centos7 local]# netstat -tunlp|grep 80

顺利启动NGINX。

[root@centos7 local]# systemctl start nginx
[root@centos7 local]# netstat -tunlp|grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      6782/nginx: master  
tcp6       0      0 :::80                   :::*                    LISTEN      6782/nginx: master 

打开网页,测试成功。


猜你喜欢

转载自blog.csdn.net/zsx0728/article/details/80898847