centos6.5编译安装nginx
一、下载nginx安装包,官网下载中心http://nginx.org/download
[root@localhost software]# wget http://nginx.org/download/nginx-1.10.1.tar.gz
二、解压nginx安装包
[root@localhost software]# tar -xzvf nginx-1.10.1.tar.gz
三、安装相关库和安装依赖(gzip模块需要 zlib 库,rewrite模块需要 pcre 库,ssl 功能需要openssl库)
[root@localhost software]# yum -y install gcc pcre-devel zlib-devel openssl-devel
四、执行configure命令(--prefix是打算将Nginx安装路径)
[root@localhost nginx-1.10.1]# ./configure --prefix=/usr/local/nginx
//执行configure成功后,显示的信息。 checking for zlib library ... found creating objs/Makefile Configuration summary + using system PCRE library + OpenSSL library is not used + using builtin md5 code + sha1 library is not found + using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/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 install)
[root@localhost nginx-1.10.1]# make && make install
六、启动nginx服务
[root@localhost nginx-1.10.1]# cd /usr/local/nginx/ [root@localhost nginx]# ./sbin/nginx
七、安装成功(通过浏览器访问,记得开放80端口或者关闭防火墙)