VPS 上安装 Nginx 就是这么简单


以下内容仅适用于 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

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

systemctl stop firewalld

五、其他

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

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

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM