linux系统为Centos6.5 64位
nginx为1.4.7
从http://nginx.org/download/上下载相应的版本
解压 tar -zxvf nginx-1.4.7.tar.gz
设置一下配置信息: ./configure --prefix=/usr/local/nginx (如果不执行此命令,make的时候可能会报错【make:No targets specified and no makefile found stop】)
make编译
make install安装
执行./configure --prefix=/usr/local/nginx可能会出现错误
【错误为:】./configure: error: the HTTP rewrite module requires the PCRE library.
【解决办法:】安装pcre-devel解决问题 yum -y install pcre-devel
【错误为:】/configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
【解决办法:】yum -y install openssl openssl-devel
然后启动/usr/nginx/sbin/nginx
修改了nginx.conf文件之后,最好检查一下文件是否配置正确 执行:/usr/nginx/sbin/nginx -t
nginx重启的话,别杀进程,再重启,执行/usr/nginx/sbin/nginx -s reload
访问后会显示如图:
然后就安装成功了!!!