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