nginx的yum安装
更新:HHH   时间:2023-1-7


Nginx的基本使用
1.Nginx的基本使用
1、nginx.org官网

[root@xingdian ~]# 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
[root@xingdian ~]# yum -y install nginx
[root@xingdian ~]# systemctl restart nginx
[root@xingdian ~]# systemctl enable nginx
[root@xingdian ~]# ss -antp |grep :80

3.nginx简单使用
Nginx的配置文件
[root@xingdian ~]# cat /etc/nginx/nginx.conf

[root@xingdian nginx]# cat conf.d/default.conf

Nginx的网页文件
[root@nginx ~]# echo 'nginx test first page' > /usr/share/nginx/html/index.html
[root@nginx ~]# elinks --dump 192.168.135.160
nginx test first page

网页访问:https://172.16.179.166:80

返回云计算教程...