-
centos下将系统预置yum源更换为阿里云源
- 备份/etc/yum.repos.d/下的CentOS-Base.repo为CentOS-Base.repo.backup 并更换为阿里云源。
-
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- 运行yum makecache生成缓存
- 添加源
-
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
-
- 安装nginx
-
sudo yum install -y nginx
-
- 设置linux开机启动 nginx
-
sudo systemctl start nginx.service sudo systemctl enable nginx.service
-
- 设置远程访问
-
vi /etc/sysconfig/iptables
- 文件最后加入 -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
- systemctl stop firewalld (关闭防火墙)
-
- 启动nginx
- systemctl restart nginx
- 访问你服务器网站
- http://192.168.241.129/ (你的ip)
- 成功
linux-最简单 安装nginx
最新推荐文章于 2022-12-07 11:30:56 发布