How To Install Nginx on CentOS 7

Posted in :

安裝 Nginx
在 RHEL, CentOS 或 Fedora 安裝 Nginx, 最簡單的方法是先加入 Nginx 的 CentOS 7 yum repository, 然後用 Yum 安裝, 輸入以下指令安裝:

# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# yum install nginx

安裝好 Nginx 網頁伺服器後, 便可以用 systemctl 啟動/停止/重新啟動 Nginx, 現在啟動 Nginx 及設定開機自動啟動:

# systemctl start nginx.service
# systemctl enable nginx.service

啟動後, 便可以用瀏覽器檢查 Nginx 是否可以連接, 例如:

http://server-ip/


About Nginx

Nginx is a high performance web server software. It is a much more flexible and lightweight program than Apache HTTP Server.

 


如何知道目前 nginx 版本:

/usr/sbin/nginx -v

執行結果:

$ /usr/sbin/nginx -v
nginx version: nginx/1.12.1

 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *