nginx安裝(1) ttlsa教程系列之nginx
當(dāng)今nginx的勁頭越來越猛,記得2011年版本才1.0.6,現(xiàn)在已經(jīng)更新到了1.5.1,nginx的更新速度越來越快。一直想記錄一系列的nginx教程,處于各種原因沒去做.今年抽出時間完成平時工作上用到的nginx.后續(xù)將會以視頻教程的方式來做。當(dāng)然,還是文章先出,下一篇文章將會講nginx虛擬主機(jī)配置。有什么建議,望大家留言。
1、必要軟件準(zhǔn)備
•安裝pcre
為了支持rewrite功能,我們需要安裝pcre
view sourceprint?
# yum install pcre* //如過你已經(jīng)裝了,請?zhí)^這一步
•安裝openssl
需要ssl的支持,如果不需要ssl支持,請?zhí)^這一步
# yum install openssl*
2、安裝nginx
執(zhí)行如下命令:
# ./configure --prefix=/usr/local/nginx-1.5.1 \
--with-http_ssl_module --with-http_spdy_module \
--with-http_stub_status_module --with-pcre
–with-http_stub_status_module:支持nginx狀態(tài)查詢
–with-http_ssl_module:支持https
–with-http_spdy_module:支持google的spdy,想了解請百度spdy,這個必須有ssl的支持
–with-pcre:為了支持rewrite重寫功能,必須制定pcre
最后輸出如下內(nèi)容,表示configure OK了。
...
checking for zlib library ... found
creating objs/Makefile
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
nginx path prefix: "/usr/local/nginx-1.5.1"
nginx binary file: "/usr/local/nginx-1.5.1/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx-1.5.1/conf"
nginx configuration file: "/usr/local/nginx-1.5.1/conf/nginx.conf"
nginx pid file: "/usr/local/nginx-1.5.1/logs/nginx.pid"
nginx error log file: "/usr/local/nginx-1.5.1/logs/error.log"
nginx http access log file: "/usr/local/nginx-1.5.1/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
# make //確定你的服務(wù)器有安裝make,如果沒有安裝請執(zhí)行yum install make
# make install
3、啟動、關(guān)閉、重置nginx
啟動:直接執(zhí)行以下命令,nginx就啟動了,不需要改任何配置文件,nginx配置多域名虛擬主機(jī)請參考后續(xù)文章.
/usr/local/nginx-1.5.1/sbin/nginx
試試訪問:我這邊不貼圖,直接使用curl命令來讀取web信息
[root@ns conf]# curl -s http://localhost | grep nginx.com
nginx.com.
關(guān)閉:
/usr/local/nginx-1.5.1/sbin/nginx -s stop
重置:當(dāng)你有修改配置文件的時候,只需要reload以下即可
/usr/local/nginx-1.5.1/sbin/nginx -s reload
整個nginx的安裝就到這里結(jié)束了。
相關(guān)文章
nginx+lua單機(jī)上萬并發(fā)的實(shí)現(xiàn)
nginx是我們最常用的服務(wù)器,常用于做內(nèi)容分發(fā)和反向代理,本文主要介紹了nginx+lua單機(jī)上萬并發(fā)的實(shí)現(xiàn),有興趣的可以了解下2021-05-05
LNMPA遇到504 Gateway time-out錯誤的解決方法
這篇文章主要介紹了LNMPA遇到504 Gateway time-out錯誤的解決方法,需要的朋友可以參考下2017-07-07
nginx實(shí)現(xiàn)tomcat動靜分離詳解
本篇文章主要介紹了nginx實(shí)現(xiàn)tomcat動靜分離詳解,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-06-06

