yum部署nginx

最后都变了- 提交于 2020-08-16 06:49:12

操作系统:RHEL/CentOS

实战任务:yum部署nginx

[root@sky9899 yum.repos.d]# vi  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


[root@sky9899 /]# yum-config-manager --enable nginx-mainline

已加载插件:fastestmirror

==================== repo: nginx-mainline =====================

[nginx-mainline]

async = True

bandwidth = 0

base_persistdir = /var/lib/yum/repos/x86_64/7

baseurl = http://nginx.org/packages/mainline/centos/7/x86_64/

cache = 0

cachedir = /var/cache/yum/x86_64/7/nginx-mainline

check_config_file_age = True

compare_providers_priority = 80

cost = 1000

deltarpm_metadata_percentage = 100

deltarpm_percentage = 

enabled = 1

enablegroups = True

exclude = 

failovermethod = priority

ftp_disable_epsv = False

gpgcadir = /var/lib/yum/repos/x86_64/7/nginx-mainline/gpgcadir

gpgcakey = 

gpgcheck = True

gpgdir = /var/lib/yum/repos/x86_64/7/nginx-mainline/gpgdir

gpgkey = https://nginx.org/keys/nginx_signing.key

hdrdir = /var/cache/yum/x86_64/7/nginx-mainline/headers

http_caching = all

includepkgs = 

ip_resolve = 

keepalive = True

keepcache = False

mddownloadpolicy = sqlite

mdpolicy = group:small

mediaid = 

metadata_expire = 21600

metadata_expire_filter = read-only:present

metalink = 

minrate = 0

mirrorlist = 

mirrorlist_expire = 86400

name = nginx mainline repo

old_base_cache_dir = 

password = 

persistdir = /var/lib/yum/repos/x86_64/7/nginx-mainline

pkgdir = /var/cache/yum/x86_64/7/nginx-mainline/packages

proxy = False

proxy_dict = 

proxy_password = 

proxy_username = 

repo_gpgcheck = False

retries = 10

skip_if_unavailable = False

ssl_check_cert_permissions = True

sslcacert = 

sslclientcert = 

sslclientkey = 

sslverify = True

throttle = 0

timeout = 30.0

ui_id = nginx-mainline/7/x86_64

ui_repoid_vars = releasever,

   basearch

username = 


[root@sky9899 /]# yum list | grep nginx

nginx.x86_64                                1:1.18.0-1.el7.ngx         nginx-stable

nginx-debug.x86_64                          1:1.9.7-1.el7.ngx          nginx-mainline

nginx-debuginfo.x86_64                      1:1.18.0-1.el7.ngx         nginx-stable

nginx-module-geoip.x86_64                   1:1.18.0-1.el7.ngx         nginx-stable

nginx-module-geoip-debuginfo.x86_64         1:1.18.0-1.el7.ngx         nginx-stable

nginx-module-image-filter.x86_64            1:1.18.0-1.el7.ngx         nginx-stable

nginx-module-image-filter-debuginfo.x86_64  1:1.18.0-1.el7.ngx         nginx-stable

nginx-module-njs.x86_64                     1:1.18.0.0.4.0-1.el7.ngx   nginx-stable

nginx-module-njs-debuginfo.x86_64           1:1.18.0.0.4.0-1.el7.ngx   nginx-stable

nginx-module-perl.x86_64                    1:1.18.0-1.el7.ngx         nginx-stable

nginx-module-perl-debuginfo.x86_64          1:1.18.0-1.el7.ngx         nginx-stable

nginx-module-xslt.x86_64                    1:1.18.0-1.el7.ngx         nginx-stable

nginx-module-xslt-debuginfo.x86_64          1:1.18.0-1.el7.ngx         nginx-stable

nginx-nr-agent.noarch                       2.0.0-12.el7.ngx           nginx-mainline

pcp-pmda-nginx.x86_64                       4.3.2-7.el7_8              updates  

unit.x86_64                                 0.1-1.el7.ngx              nginx-mainline

unit-debuginfo.x86_64                       0.1-1.el7.ngx              nginx-mainline

unit-devel.x86_64                           0.1-1.el7.ngx              nginx-mainline

[root@sky9899 /]# yum install nginx  -y

[root@sky9899 /]# rpm -q nginx

nginx-1.18.0-1.el7.ngx.x86_64

[root@sky9899 /]# systemctl start nginx.service

[root@sky9899 /]# systemctl enable nginx.service

#查看nginx进程

[root@sky9899 /]# ps -ef | grep nginx

root     15494     1  0 14:59 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf

nginx    15495 15494  0 14:59 ?        00:00:00 nginx: worker process

root     15535 14840  0 15:00 pts/0    00:00:00 grep --color=auto nginx

#查看80端口

[root@sky9899 /]# netstat -nltp|grep 80

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      15494/nginx: master 

[root@sky9899 nginx]# ls

conf.d  fastcgi_params  koi-utf  koi-win  mime.types  modules  nginx.conf  scgi_params  uwsgi_params  win-utf

#安装目

[root@sky9899 nginx]# pwd    

/etc/nginx

#发布程序目录 

[root@sky9899 html]# pwd

/usr/share/nginx/html

小结:部署nginx有两种方式,yum部署和源码编译安装部署,这两种方式有所不同,建议生产环境使用源码编译部署。

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!