centos7.6安装nginx

[root@vmcentos7 ~]# yum install nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* remi-php80: mirrors.tuna.tsinghua.edu.cn
* remi-safe: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.16.1-3.el7 will be installed
--> Processing Dependency: nginx-all-modules = 1:1.16.1-3.el7 for package: 1:nginx-1.16.1-3.el7.x86_64
--> Processing Dependency: nginx-filesystem = 1:1.16.1-3.el7 for package: 1:nginx-1.16.1-3.el7.x86_64
--> Processing Dependency: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.16.1-3.el7.x86_64
--> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.16.1-3.el7.x86_64
--> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_1)(64bit) for package: 1:nginx-1.16.1-3.el7.x86_64
--> Processing Dependency: nginx-filesystem for package: 1:nginx-1.16.1-3.el7.x86_64
--> Processing Dependency: redhat-indexhtml for package: 1:nginx-1.16.1-3.el7.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: 1:nginx-1.16.1-3.el7.x86_64
--> Processing Dependency: libprofiler.so.0()(64bit) for package: 1:nginx-1.16.1-3.el7.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: 1:nginx-1.16.1-3.el7.x86_64
--> Running transaction check
---> Package centos-indexhtml.noarch 0:7-9.el7.centos will be installed
---> Package gperftools-libs.x86_64 0:2.6.1-1.el7 will be installed
---> Package nginx-all-modules.noarch 1:1.16.1-3.el7 will be installed
--> Processing Dependency: nginx-mod-http-image-filter = 1:1.16.1-3.el7 for package: 1:nginx-all-modules-1.16.1-3.el7.noarch
--> Processing Dependency: nginx-mod-http-perl = 1:1.16.1-3.el7 for package: 1:nginx-all-modules-1.16.1-3.el7.noarch
--> Processing Dependency: nginx-mod-http-xslt-filter = 1:1.16.1-3.el7 for package: 1:nginx-all-modules-1.16.1-3.el7.noarch
--> Processing Dependency: nginx-mod-mail = 1:1.16.1-3.el7 for package: 1:nginx-all-modules-1.16.1-3.el7.noarch
--> Processing Dependency: nginx-mod-stream = 1:1.16.1-3.el7 for package: 1:nginx-all-modules-1.16.1-3.el7.noarch
---> Package nginx-filesystem.noarch 1:1.16.1-3.el7 will be installed
---> Package openssl11-libs.x86_64 1:1.1.1g-2.el7 will be installed
--> Running transaction check
---> Package nginx-mod-http-image-filter.x86_64 1:1.16.1-3.el7 will be installed
--> Processing Dependency: gd for package: 1:nginx-mod-http-image-filter-1.16.1-3.el7.x86_64
--> Processing Dependency: libgd.so.2()(64bit) for package: 1:nginx-mod-http-image-filter-1.16.1-3.el7.x86_64
---> Package nginx-mod-http-perl.x86_64 1:1.16.1-3.el7 will be installed
---> Package nginx-mod-http-xslt-filter.x86_64 1:1.16.1-3.el7 will be installed
---> Package nginx-mod-mail.x86_64 1:1.16.1-3.el7 will be installed
---> Package nginx-mod-stream.x86_64 1:1.16.1-3.el7 will be installed
--> Running transaction check
---> Package gd.x86_64 0:2.0.35-27.el7_9 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================================================================
Installing:
nginx x86_64 1:1.16.1-3.el7 epel 563 k
Installing for dependencies:
centos-indexhtml noarch 7-9.el7.centos base 92 k
gd x86_64 2.0.35-27.el7_9 updates 146 k
gperftools-libs x86_64 2.6.1-1.el7 base 272 k
nginx-all-modules noarch 1:1.16.1-3.el7 epel 20 k
nginx-filesystem noarch 1:1.16.1-3.el7 epel 21 k
nginx-mod-http-image-filter x86_64 1:1.16.1-3.el7 epel 30 k
nginx-mod-http-perl x86_64 1:1.16.1-3.el7 epel 39 k
nginx-mod-http-xslt-filter x86_64 1:1.16.1-3.el7 epel 29 k
nginx-mod-mail x86_64 1:1.16.1-3.el7 epel 57 k
nginx-mod-stream x86_64 1:1.16.1-3.el7 epel 85 k
openssl11-libs x86_64 1:1.1.1g-2.el7 epel 1.5 M

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

Total download size: 2.8 M
Installed size: 7.5 M

Downloading packages:
(1/12): gd-2.0.35-27.el7_9.x86_64.rpm | 146 kB 00:00:00
(2/12): centos-indexhtml-7-9.el7.centos.noarch.rpm | 92 kB 00:00:00
(3/12): nginx-all-modules-1.16.1-3.el7.noarch.rpm | 20 kB 00:00:00
(4/12): gperftools-libs-2.6.1-1.el7.x86_64.rpm | 272 kB 00:00:00
(5/12): nginx-filesystem-1.16.1-3.el7.noarch.rpm | 21 kB 00:00:00
(6/12): nginx-mod-http-image-filter-1.16.1-3.el7.x86_64.rpm | 30 kB 00:00:00
(7/12): nginx-1.16.1-3.el7.x86_64.rpm | 563 kB 00:00:00
(8/12): nginx-mod-http-perl-1.16.1-3.el7.x86_64.rpm | 39 kB 00:00:00
(9/12): nginx-mod-http-xslt-filter-1.16.1-3.el7.x86_64.rpm | 29 kB 00:00:00
(10/12): nginx-mod-stream-1.16.1-3.el7.x86_64.rpm | 85 kB 00:00:00
(11/12): nginx-mod-mail-1.16.1-3.el7.x86_64.rpm | 57 kB 00:00:00
(12/12): openssl11-libs-1.1.1g-2.el7.x86_64.rpm | 1.5 MB 00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 6.4 MB/s | 2.8 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : centos-indexhtml-7-9.el7.centos.noarch 1/12
Installing : gperftools-libs-2.6.1-1.el7.x86_64 2/12
Installing : 1:nginx-filesystem-1.16.1-3.el7.noarch 3/12
Installing : 1:openssl11-libs-1.1.1g-2.el7.x86_64 4/12
Installing : gd-2.0.35-27.el7_9.x86_64 5/12
Installing : 1:nginx-mod-http-perl-1.16.1-3.el7.x86_64 6/12
Installing : 1:nginx-mod-mail-1.16.1-3.el7.x86_64 7/12
Installing : 1:nginx-mod-http-xslt-filter-1.16.1-3.el7.x86_64 8/12
Installing : 1:nginx-mod-stream-1.16.1-3.el7.x86_64 9/12
Installing : 1:nginx-1.16.1-3.el7.x86_64 10/12
Installing : 1:nginx-mod-http-image-filter-1.16.1-3.el7.x86_64 11/12
Installing : 1:nginx-all-modules-1.16.1-3.el7.noarch 12/12
Verifying : gd-2.0.35-27.el7_9.x86_64 1/12
Verifying : 1:openssl11-libs-1.1.1g-2.el7.x86_64 2/12
Verifying : 1:nginx-mod-http-perl-1.16.1-3.el7.x86_64 3/12
Verifying : 1:nginx-mod-mail-1.16.1-3.el7.x86_64 4/12
Verifying : 1:nginx-filesystem-1.16.1-3.el7.noarch 5/12
Verifying : gperftools-libs-2.6.1-1.el7.x86_64 6/12
Verifying : 1:nginx-mod-http-xslt-filter-1.16.1-3.el7.x86_64 7/12
Verifying : 1:nginx-all-modules-1.16.1-3.el7.noarch 8/12
Verifying : 1:nginx-1.16.1-3.el7.x86_64 9/12
Verifying : 1:nginx-mod-http-image-filter-1.16.1-3.el7.x86_64 10/12
Verifying : 1:nginx-mod-stream-1.16.1-3.el7.x86_64 11/12
Verifying : centos-indexhtml-7-9.el7.centos.noarch 12/12

Installed:
nginx.x86_64 1:1.16.1-3.el7

Dependency Installed:
centos-indexhtml.noarch 0:7-9.el7.centos gd.x86_64 0:2.0.35-27.el7_9 gperftools-libs.x86_64 0:2.6.1-1.el7 nginx-all-modules.noarch 1:1.16.1-3.el7 nginx-filesystem.noarch 1:1.16.1-3.el7
nginx-mod-http-image-filter.x86_64 1:1.16.1-3.el7 nginx-mod-http-perl.x86_64 1:1.16.1-3.el7 nginx-mod-http-xslt-filter.x86_64 1:1.16.1-3.el7 nginx-mod-mail.x86_64 1:1.16.1-3.el7 nginx-mod-stream.x86_64 1:1.16.1-3.el7
openssl11-libs.x86_64 1:1.1.1g-2.el7

Complete!

[root@vmcentos7 nginx]# vim nginx.conf
[root@vmcentos7 nginx]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@vmcentos7 nginx]# systemctl start nginx
[root@vmcentos7 nginx]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-01-19 14:50:23 CST; 18s ago
Process: 2716 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 2712 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 2711 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 2718 (nginx)
CGroup: /system.slice/nginx.service
├─2718 nginx: master process /usr/sbin/nginx
└─2719 nginx: worker process

Jan 19 14:50:23 vmcentos7.aliyun systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 19 14:50:23 vmcentos7.aliyun nginx[2712]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Jan 19 14:50:23 vmcentos7.aliyun nginx[2712]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Jan 19 14:50:23 vmcentos7.aliyun systemd[1]: Failed to parse PID from file /run/nginx.pid: Invalid argument
Jan 19 14:50:23 vmcentos7.aliyun systemd[1]: Started The nginx HTTP and reverse proxy server.

[root@vmcentos7 nginx]# curl localhost:90