2015年6月3日 星期三

NginX! 超猛的 HTTP 伺服器!



nginx

NginX! 超猛的 HTTP 伺服器!

提起 HTTP 伺服器,您會想到哪個名字?Apache?IIS?告訴大家最近這兩年竄紅的 HTTP 伺服器:「NginX」(念成 Engine-X)!

NginX 最厲害的在於它的效能!它占的記憶體比 Apache 少,跑網頁比 Apache 快!目前全世界的市佔率雖然只有 12.18%,但它竄起的速度非常可怕!很有可能「做」掉 Apache,登上王者寶座!
雖然 HTTP 伺服器的架設與程式設計沒什麼太大的關聯,不過有個好的 HTTP 伺服器,我們寫起 PHP 等網頁語言,也比較能執行迅速,不是嗎?




nginx官網:
NginX Wikipedia:
NginX 官方網站:
http://wiki.nginx.org/Main



在 CentOS 6.x 安裝 Nginx Light Web Server



Nginx 是一套輕量級的 Web Server,和 Apache Web Server 比起來,由俄羅斯程式設計師 Igor Sysoev 所開發輕量級的網頁伺服器,軟體以 BSD-like 授權,可以在 UNIX、GNU/Linux、BSD、Mac OS X、Solaris,以及Microsoft Windows 等作業系統中執行。

Nginx 官方網站:http://nginx.org/

目前有人在 Linux 使用它來取代 Apache Web Server,並把這個組合稱為 LNMP(Linux + Nginx + MySQL + PHP)
安裝方式:
因為 Nginx 並不是 CentOS 官方套件,所以必須先新增 Nginx 官方所提供的第三方套件庫
vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

匯入憑證
rpm --import http://nginx.org/keys/nginx_signing.key


wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

更新套件庫
yum update

安裝 Nginx Web Server
yum install nginx

執行 Nginx Web Server
service nginx start
Starting nginx:                                            [  OK  ]

設定開機預設啟動 Nginx 和關閉 Apache Web Server
chkconfig --level 3 nginx on
chkconfig --level 3 httpd off

開啟瀏覽器,連線到 Nginx Web Server




沒有留言:

張貼留言