Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

CentOS 使用 YUM 快速安裝 Nginx 完整步驟

編輯:Linux 教學

Nginx 是高效能的 Web 伺服器,採用 YUM 安裝最省時。本文記錄在 CentOS 5.x (x86_64) 環境下,透過 IUS 與 EPEL 軟體庫安裝穩定版 Nginx 的完整流程。

一、安裝 IUS 與 EPEL 軟體庫

wget https://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1-4.ius.el5.noarch.rpm
wget https://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-1-1.ius.el5.noarch.rpm
rpm -Uvh ius-release*.rpm epel-release*.rpm

二、使用 yum shell 安裝 Nginx 0.7 穩定版

yum shell
> install nginx07
> transaction solve
> transaction run
> quit

註:IUS 軟體庫將 Nginx 套件命名為 nginx07、nginx08 等,依版本而定。

三、驗證安裝並設定開機自啟

nginx -V          # 查看版本與編譯參數
chkconfig nginx on  # 設定開機自動啟動

四、後續工作

  • 編輯 /etc/nginx/nginx.conf 調整 worker_processes、gzip、虛擬主機等參數。
  • 安裝 PHP(建議 PHP-FPM)與 MySQL/MariaDB 完成 LEMP 架構。
  • 參考官方文件或社群教學進行進階調校。

透過 IUS/EPEL 軟體庫,即可在 CentOS 上以幾行指令完成 Nginx 部署,省去手動編譯的繁瑣過程。

Copyright © Windows教程網 All Rights Reserved