45 openEuler搭建Nginx服务器-Nginx概述和安装

文章目录

    • 45 openEuler搭建Nginx服务器-Nginx概述和安装
      • 45.1 概述
      • 45.2 安装

45 openEuler搭建Nginx服务器-Nginx概述和安装

45.1 概述

Nginx 是一款轻量级的 Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,其特点是占用内存少,并发能力强,事实上nginx的并发能力在同类型的网页服务器中表现较好,支持FastCGI、SSL、Virtual Host、URL Rewrite、Gzip等功能,并且支持很多第三方的模块扩展。

Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器 ,同时也提供了IMAP/POP3/SMTP服务。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,公开版本1.19.6发布于2020年12月15日。

其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、简单的配置文件和低系统资源的消耗而闻名。2022年01月25日,nginx 1.21.6发布。

45.2 安装

  1. 配置本地yum源,详细信息请参考《openEuler 22.03-LTS 搭建repo服务器》。

  2. 清除缓存。

# dnf clean all

例如示例命令如下:

[root@superman-21 ~]# dnf clean all
36 files removed
[root@superman-21 ~]# 
  1. 创建缓存。
# dnf makecache

例如示例命令如下:

[root@superman-21 ~]# dnf makecache
OS                                                                                           6.8 MB/s | 3.4 MB     00:00    
everything                                                                                    19 MB/s |  16 MB     00:00    
EPOL                                                                                         3.9 MB/s | 2.6 MB     00:00    
debuginfo                                                                                    3.3 MB/s | 3.9 MB     00:01    
source                                                                                       1.1 MB/s | 1.7 MB     00:01    
update                                                                                        25 MB/s |  28 MB     00:01    
Metadata cache created.
[root@superman-21 ~]#
  1. 在root权限下安装nginx服务。
# dnf install nginx

例如示例命令如下:

[root@superman-21 ~]# dnf install nginx
Last metadata expiration check: 0:00:34 ago on 2022年12月03日 星期六 10时39分32秒.
Dependencies resolved.
=============================================================================================================================
 Package                                   Architecture         Version                           Repository            Size
=============================================================================================================================
Installing:
 nginx                                     x86_64               1:1.21.5-3.oe2203                 update               498 k
Installing dependencies:
 gd                                        x86_64               2.3.2-2.oe2203                    update               127 k
 libXpm                                    x86_64               3.5.13-1.oe2203                   OS                    41 k
 libwebp                                   x86_64               1.2.1-1.oe2203                    OS                   246 k
 nginx-all-modules                         noarch               1:1.21.5-3.oe2203                 update               7.6 k
 nginx-filesystem                          noarch               1:1.21.5-3.oe2203                 update               8.7 k
 nginx-mod-http-image-filter               x86_64               1:1.21.5-3.oe2203                 update                18 k
 nginx-mod-http-perl                       x86_64               1:1.21.5-3.oe2203                 update                27 k
 nginx-mod-http-xslt-filter                x86_64               1:1.21.5-3.oe2203                 update                17 k
 nginx-mod-mail                            x86_64               1:1.21.5-3.oe2203                 update                49 k
 nginx-mod-stream                          x86_64               1:1.21.5-3.oe2203                 update                71 k

Transaction Summary
=============================================================================================================================
Install  11 Packages

Total download size: 1.1 M
Installed size: 3.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/11): libXpm-3.5.13-1.oe2203.x86_64.rpm                                                    248 kB/s |  41 kB     00:00    
(2/11): gd-2.3.2-2.oe2203.x86_64.rpm                                                         562 kB/s | 127 kB     00:00    
(3/11): nginx-all-modules-1.21.5-3.oe2203.noarch.rpm                                         168 kB/s | 7.6 kB     00:00    
(4/11): nginx-filesystem-1.21.5-3.oe2203.noarch.rpm                                          186 kB/s | 8.7 kB     00:00    
(5/11): nginx-mod-http-image-filter-1.21.5-3.oe2203.x86_64.rpm                               385 kB/s |  18 kB     00:00    
(6/11): libwebp-1.2.1-1.oe2203.x86_64.rpm                                                    611 kB/s | 246 kB     00:00    
(7/11): nginx-mod-http-perl-1.21.5-3.oe2203.x86_64.rpm                                       431 kB/s |  27 kB     00:00    
(8/11): nginx-mod-http-xslt-filter-1.21.5-3.oe2203.x86_64.rpm                                395 kB/s |  17 kB     00:00    
(9/11): nginx-mod-mail-1.21.5-3.oe2203.x86_64.rpm                                            816 kB/s |  49 kB     00:00    
(10/11): nginx-mod-stream-1.21.5-3.oe2203.x86_64.rpm                                         791 kB/s |  71 kB     00:00    
(11/11): nginx-1.21.5-3.oe2203.x86_64.rpm                                                    1.1 MB/s | 498 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        1.7 MB/s | 1.1 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                     1/1 
  Running scriptlet: nginx-filesystem-1:1.21.5-3.oe2203.noarch                                                          1/11 
  Installing       : nginx-filesystem-1:1.21.5-3.oe2203.noarch                                                          1/11 
  Installing       : libwebp-1.2.1-1.oe2203.x86_64                                                                      2/11 
  Installing       : libXpm-3.5.13-1.oe2203.x86_64                                                                      3/11 
  Installing       : gd-2.3.2-2.oe2203.x86_64                                                                           4/11 
  Running scriptlet: gd-2.3.2-2.oe2203.x86_64                                                                           4/11 
  Installing       : nginx-mod-http-perl-1:1.21.5-3.oe2203.x86_64                                                       5/11 
  Running scriptlet: nginx-mod-http-perl-1:1.21.5-3.oe2203.x86_64                                                       5/11 
  Installing       : nginx-mod-http-xslt-filter-1:1.21.5-3.oe2203.x86_64                                                6/11 
  Running scriptlet: nginx-mod-http-xslt-filter-1:1.21.5-3.oe2203.x86_64                                                6/11 
  Installing       : nginx-mod-mail-1:1.21.5-3.oe2203.x86_64                                                            7/11 
  Running scriptlet: nginx-mod-mail-1:1.21.5-3.oe2203.x86_64                                                            7/11 
  Installing       : nginx-mod-stream-1:1.21.5-3.oe2203.x86_64                                                          8/11 
  Running scriptlet: nginx-mod-stream-1:1.21.5-3.oe2203.x86_64                                                          8/11 
  Installing       : nginx-1:1.21.5-3.oe2203.x86_64                                                                     9/11 
  Running scriptlet: nginx-1:1.21.5-3.oe2203.x86_64                                                                     9/11 
  Installing       : nginx-mod-http-image-filter-1:1.21.5-3.oe2203.x86_64                                              10/11 
  Running scriptlet: nginx-mod-http-image-filter-1:1.21.5-3.oe2203.x86_64                                              10/11 
  Installing       : nginx-all-modules-1:1.21.5-3.oe2203.noarch                                                        11/11 
  Running scriptlet: nginx-all-modules-1:1.21.5-3.oe2203.noarch                                                        11/11 
  Verifying        : libXpm-3.5.13-1.oe2203.x86_64                                                                      1/11 
  Verifying        : libwebp-1.2.1-1.oe2203.x86_64                                                                      2/11 
  Verifying        : gd-2.3.2-2.oe2203.x86_64                                                                           3/11 
  Verifying        : nginx-1:1.21.5-3.oe2203.x86_64                                                                     4/11 
  Verifying        : nginx-all-modules-1:1.21.5-3.oe2203.noarch                                                         5/11 
  Verifying        : nginx-filesystem-1:1.21.5-3.oe2203.noarch                                                          6/11 
  Verifying        : nginx-mod-http-image-filter-1:1.21.5-3.oe2203.x86_64                                               7/11 
  Verifying        : nginx-mod-http-perl-1:1.21.5-3.oe2203.x86_64                                                       8/11 
  Verifying        : nginx-mod-http-xslt-filter-1:1.21.5-3.oe2203.x86_64                                                9/11 
  Verifying        : nginx-mod-mail-1:1.21.5-3.oe2203.x86_64                                                           10/11 
  Verifying        : nginx-mod-stream-1:1.21.5-3.oe2203.x86_64                                                         11/11 

Installed:
  gd-2.3.2-2.oe2203.x86_64                                          libXpm-3.5.13-1.oe2203.x86_64                            
  libwebp-1.2.1-1.oe2203.x86_64                                     nginx-1:1.21.5-3.oe2203.x86_64                           
  nginx-all-modules-1:1.21.5-3.oe2203.noarch                        nginx-filesystem-1:1.21.5-3.oe2203.noarch                
  nginx-mod-http-image-filter-1:1.21.5-3.oe2203.x86_64              nginx-mod-http-perl-1:1.21.5-3.oe2203.x86_64             
  nginx-mod-http-xslt-filter-1:1.21.5-3.oe2203.x86_64               nginx-mod-mail-1:1.21.5-3.oe2203.x86_64                  
  nginx-mod-stream-1:1.21.5-3.oe2203.x86_64                        

Complete!
[root@superman-21 ~]# 
  1. 查看安装后的rpm包。
# dnf list all | grep nginx

例如示例命令如下:

[root@superman-21 ~]# dnf list all | grep nginx
nginx.x86_64                                            1:1.21.5-3.oe2203                            @update   
nginx-all-modules.noarch                                1:1.21.5-3.oe2203                            @update   
nginx-filesystem.noarch                                 1:1.21.5-3.oe2203                            @update   
nginx-mod-http-image-filter.x86_64                      1:1.21.5-3.oe2203                            @update   
nginx-mod-http-perl.x86_64                              1:1.21.5-3.oe2203                            @update   
nginx-mod-http-xslt-filter.x86_64                       1:1.21.5-3.oe2203                            @update   
nginx-mod-mail.x86_64                                   1:1.21.5-3.oe2203                            @update   
nginx-mod-stream.x86_64                                 1:1.21.5-3.oe2203                            @update   
nginx.src                                               1:1.21.5-1.oe2203                            source    
nginx-debuginfo.x86_64                                  1:1.21.5-3.oe2203                            update    
nginx-debugsource.x86_64                                1:1.21.5-3.oe2203                            update    
nginx-help.noarch                                       1:1.21.5-3.oe2203                            update    
pcp-pmda-nginx.x86_64                                   5.3.5-6.oe2203                               OS        
pcp-pmda-nginx.x86_64                                   5.3.5-6.oe2203                               everything
[root@superman-21 ~]# 

点赞,你的认可是我创作的动力!

⭐️ 收藏,你的青睐是我努力的方向!

✏️ 评论,你的意见是我进步的财富!

你可能感兴趣的:(服务器,nginx,运维,开源软件,linux)