注意:Nginx端口号是80(云服务器要放行) 我的是基于yum源安装
安装yum源(下面这4步就好了)
java
YUM源
1、将源文件备份
cd /etc/yum.repos.d/ && mkdir backup && mv *repo backup/
2、下载阿里源文件
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3、更新源里面的地址
sed -i -e "s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-*
sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-*
4、生成缓存
yum clean all && yum makecache
一、步骤:
1. 添加Nginx的Yum仓库。创建一个新的repo文件:
java
sudo tee /etc/yum.repos.d/nginx.repo <<EOL
[nginx-stable]
name=nginx stable repo
baseurl=https://nginx.org/packages/centos/\$releasever/\$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
EOL
2. 安装Nginx:
java
sudo yum install nginx
3.启动Nginx服务:
java
sudo systemctl start nginx
4.(可选)设置Nginx开机自启:
java
sudo systemctl enable nginx
5. 验证Nginx是否正确安装并运行:
java
systemctl status nginx
二、页面(IP:80)
到这里就结束啦,感谢各位小伙伴的观看!!!