CentOS6編譯安裝Nginx-1.8.1

Nginx介紹

Nginx ("engine x") 是一個高性能的HTTP和 反向代理 服務器,也是一個 IMAP/POP3/SMTP 服務器。Nginx 是由 Igor Sysoev 爲俄羅斯訪問量第二的 Rambler.ru 站點開發的,第一個公開版本0.1.0發佈於2004年10月4日。其將源代碼以類BSD許可證的形式發佈,因它的穩定性、豐富的功能集、示例配置文件和低系統資源的消耗而聞名。

特點:
Nginx是一款面向性能設計的HTTP服務器,相較於Apache、lighttpd具有佔有內存少,穩定性高等優勢。

優點:
1.處理靜態文件,索引文件以及自動索引;打開文件描述符緩衝.
2.無緩存的反向代理加速,簡單的負載均衡和容錯.
3.FastCGI,簡單的負載均衡和容錯.
4.模塊化的結構。包括gzipping, byte ranges, chunked responses, 以及 SSI-filter等filter。如果由FastCGI或其它代理服務器處理單頁中存在的多個SSI,則這項處理可以並行運行,而不需要相互等待。
5.支持SSL 和 TLS SNI.

安裝依賴包

1.pcre庫 perl兼容正則表達式
安裝pcre庫後nginx可以使用URI重寫功能和rewrite模塊。
檢查pcre是否安裝
[root@linuxidc ~]# rpm -qa pcre pcre-devel
pcre-devel-7.8-7.el6.x86_64
pcre-7.8-7.el6.x86_64
可以使用yum安裝
[root@linuxidc ~]# yum install pcre pcre-devel -y

2.openssl-devel
安裝openssl-devel後nginx可以使用加密服務
檢查openssl-devel是否安裝
[root@localhost~]# rpm -qa openssl-devel
openssl-devel-1.0.1e-42.el6_7.4.x86_64
可以使用yum安裝
[root@localhost~]# yum install openssl-devel -y

安裝nginx
下載nginx
[root@localhost app]# wget http://nginx.org/download/nginx-1.8.1.tar.gz

如果在命令行下載不了,可以百度上下載好後再上傳
[root@llocalhost app]# ls -l nginx-1.8.1.tar.gz 
-rw-r--r-- 1 root root 833473 1月  27 00:30 nginx-1.8.1.tar.gz
解壓
[root@llocalhost app]# tar -zxvf nginx-1.8.1.tar.gz 
編譯安裝
[root@llocalhost app]# cd nginx-1.8.1
編譯參數
./configure  --prefix=/usr/local/app/nginx  --with-http_stub_status_module  --with-http_ssl_module
make
make install


啓動nginx
檢查語法
[root@llocalhost nginx]# ./nginx -t
nginx: the configuration file /usr/local/app/nginx1.8.1/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/app/nginx1.8.1/conf/nginx.conf test is successful
啓動
[root@llocalhost nginx]# nginx

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章