byourb 2019-10-20
[ ~]# vim /etc/yum.repos.d/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
主线版:
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=0
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
2、安装nginx
[ ~]# yum -y install nginx
[ ~]# systemctl restart nginx
[ ~]# systemctl enable nginx
[ ~]# ss -antp |grep :80
3.nginx简单使用
Nginx的配置文件
[ ~]# cat /etc/nginx/nginx.conf
[ nginx]# cat conf.d/default.conf
Nginx的网页文件
[ ~]# echo ‘nginx test first page‘ > /usr/share/nginx/html/index.html
[ ~]# elinks --dump 192.168.135.160
nginx test first page