为了支持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