以下内容仅适用于 Centos 操作系统

一、将系统的软件包更新到最新版本

yum -y update

二、安装 Nginx

yum install nginx

三、启动 Nginx,并设置开机启动

systemctl start nginx
systemctl enable nginx

四、开启防火墙的 80 端口和 443 端口

firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd --reload

VPS 上安装 Nginx 就是这么简单

ps:可以通过以下命令关掉防火墙,不推荐在生产环境关闭防火墙!

systemctl stop firewalld

五、其他

Nginx 主配置文件路径:
/etc/nginx/nginx.conf

虚拟主机配置文件路径:
/etc/nginx/conf.d/

默认的 www 目录:
/usr/share/nginx/html/

相关文章:

  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-09
  • 2021-11-22
  • 2021-05-29
  • 2021-12-24
  • 2021-07-07
  • 2021-06-26
相关资源
相似解决方案