爲了支持rewrite功能,咱們須要安裝pcrehtml
1
|
# yum install pcre* //如過你已經裝了,請跳過這一步
|
須要ssl的支持,若是不須要ssl支持,請跳過這一步nginx
1
|
# yum install openssl*
|
執行以下命令:web
1
2
3
|
# ./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狀態查詢
--with-http_ssl_module:支持https
--with-http_spdy_module:支持google的spdy,想了解請百度spdy,這個必須有ssl的支持
--with-pcre:爲了支持rewrite重寫功能,必須制定pcre服務器
--with-http_stub_status_module:支持nginx狀態查詢
--with-http_ssl_module:支持https
--with-http_spdy_module:支持google的spdy,想了解請百度spdy,這個必須有ssl的支持
--with-pcre:爲了支持rewrite重寫功能,必須制定pcrecurl
最後輸出以下內容,表示configure OK了。
.....ide
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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 //肯定你的服務器有安裝make,若是沒有安裝請執行yum install make
# make install
|
啓動:直接執行如下命令,nginx就啓動了,不須要改任何配置文件,nginx配置多域名虛擬主機請參考後續文章.google
1
|
/usr/local/nginx-1.5.1/sbin/nginx
|
試試訪問:我這邊不貼圖,直接使用curl命令來讀取web信息url
[root@ns conf]# curl -s http://localhost | grep nginx.com
nginx.com.
|
關閉:spa
1
|
/usr/local/nginx-1.5.1/sbin/nginx -s stop
|
重置:當你有修改配置文件的時候,只須要reload如下便可code
1
|
/usr/local/nginx-1.5.1/sbin/nginx -s reload
|
整個nginx的安裝就到這裏結束了。
出處:http://www.ttlsa.com/html/1548.html