centos6.5编译安装nginx

Posted Yxh_blogs

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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端口或者关闭防火墙)

 

以上是关于centos6.5编译安装nginx的主要内容,如果未能解决你的问题,请参考以下文章

CentOS6.5编译安装Nginx

centos6.5编译安装nginx[整理二]

基于CentOS6.5环境之下的LNMP之编译安装Nginx1.8.0 stable(稳定版)

centos6.5 安装nginx

Centos6.5源码编译安装nginx

CentOS6.5下nginx安装