官網(wǎng)提供的 RHEL/CentOS 安裝方法
1:先添加nginx yum源,分為穩(wěn)定版和開(kāi)發(fā)版日熬,復(fù)制其中一個(gè)
nginx yum源
2:新建 nginx.repo 文件棍厌,添加上面復(fù)制的源并保存
[root@localhost etc]# vim /etc/yum.repos.d/nginx.repo
3:保存后查看是否添加成功,輸入 yum list | grep nginx 命令
[root@localhost yum.repos.d]# yum list | grep nginx
nginx.x86_64 1:1.16.1-1.el7.ngx nginx-stable
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-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.5-1.el7.ngx nginx-stable
nginx-module-njs-debuginfo.x86_64 1:1.16.1.0.3.5-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
pcp-pmda-nginx.x86_64 4.1.0-5.el7_6 updates
4:然后直接使用 yum install nginx 安裝命令進(jìn)行安裝即可
[root@localhost yum.repos.d]# yum install nginx
5:安裝完成后使用 nginx -v 即可查看當(dāng)前安裝nginx版本
[root@localhost yum.repos.d]# nginx -v
nginx version: nginx/1.16.1
nginx安裝目錄功能講解
使用 rpm -ql nginx 命令查看nginx安裝目錄
[root@localhost ~]# 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
Nginx日志輪轉(zhuǎn),用于logrotate服務(wù)的日志切割:
/etc/logrotate.d/nginx
nginx主配置文件:
/etc/nginx
/etc/nginx/nginx.conf
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
cgi配置相關(guān)耘纱,fastcgi配置:
/etc/nginx/fastcgi_params
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
編碼轉(zhuǎn)換映射轉(zhuǎn)化文件:
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/win-utf
設(shè)置http協(xié)議的Content-Type與擴(kuò)展名對(duì)應(yīng)關(guān)系:
/etc/nginx/mime.types
用于配置出系統(tǒng)守護(hù)進(jìn)程管理器管理方式:
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug
/usr/lib/systemd/system/nginx-debug.service
/usr/lib/systemd/system/nginx.service
nginx服務(wù)的啟動(dòng)管理的終端命令:
/usr/sbin/nginx
/usr/sbin/nginx-debug
nginx模塊目錄:
/etc/nginx/modules
/usr/lib64/nginx/modules
nginx的手冊(cè)和幫助文件:
/usr/share/doc/nginx-1.16.1
/usr/share/doc/nginx-1.16.1/COPYRIGHT
/usr/share/man/man8/nginx.8.gz
nginx的緩存目錄:
/var/cache/nginx
nginx的日志目錄:
/var/log/nginx