下载nginx源码包,可以到nginx官方的下载文件归档里 http://nginx.org/download/ 下载

下载pcre源码,并编译安装,从pcre官方下载  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.zip

解压缩 unzip pcre-8.21.zip

进入源码目录 cd pcre-8.21/

./configure

make

make install

全部使用默认,不必要指定目录,这样包容易被找到。

安装nginx

这里使用nginx 1.0.8为例。

下载源码包  wget http://nginx.org/download/nginx-1.0.8.tar.gz

解压缩 tar xvf nginx-1.0.8.tar.gz

进入源码目录 cd nginx-1.0.8/

查看配置参数 ./configure --help (此步可以省略)

简单配置 ./configure
(注:centos 6 默认安装pcre包的,但是其安装位置并不为nginx识别,而且即使手工指定好像也不行,编译过程中会提示找不到文件;所以才需要先安装pcre包)

不指定任何配置选项,应该可以成功通过,得到如下的消息

Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
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 就安装好了。

先测试一下是否可以运行,执行 /usr/local/nginx/sbin/nginx 没有消息提示,通过浏览器打开nginx所在的ip地址,应该可以看到

Welcome to nginx!

安装nginx所需要的pcre-devel库,是为了是Nginx支持http Rewrite模块。
openssl-devel
yum -y install openssl openssl-devel

这样的一个简单页面,证明nginx可以工作。

接下来的工作就是配置nginx了,其配置文件为/usr/local/nginx/conf/nginx.conf

centos 6 下编译安装 nginx的更多相关文章

  1. 在CentOS 7下编译安装Nginx+PHP+MySQL环境

    本文转载自:http://www.softeng.cn/?p=156,本文已获得作者授权,未经作者同意,不可转载. 1.前言 本文适合于已经对Linux操作系统具有基本操作经验,并且能够在Linux或 ...

  2. Centos 7下编译安装Nginx

    一.下载源代码 百度云网盘下载地址:https://pan.baidu.com/s/19MQODvofRNnLV9hdAT-R6w 提取码:zi0u 二.安装依赖及插件 yum -y install ...

  3. linux下编译安装nginx

    1.首先下载稳定版nginx1.10.2 使用wget命令下载 wget http://nginx.org/download/nginx-1.10.2.tar.gz 2.然后解压 tar -zxvf  ...

  4. CentOS 7 下编译安装lnmp之nginx篇详解

    一.安装环境 宿主机=> win7,虚拟机 centos => 系统版本:CentOS Linux release 7.5.1804 (Core),ip地址 192.168.1.168   ...

  5. CentOS 6.5 下编译安装 Nginx 1.8.0

    转自:https://i.cnblogs.com/EditPosts.aspx?postid=8303227&update=1 安装编译依赖的包 yum -y install gcc gcc- ...

  6. centos 6.3 编译安装 nginx +mysql + php

    这篇文章是对另一篇文章的整理,作为记录收藏 1,配置防火墙,开启80端口.3306端口 配置iptables,开启80端口.3306端口 vi /etc/sysconfig/iptables -A I ...

  7. centos源码编译安装nginx过程记录

    前言:Centos系统编译安装LNMP环境是每来一台新服务器或换电脑都需要做的事情.这里仅做一个记录.给初学者一个参考! 一.安装前的环境 这里用的是centos 7系统. 我们默认把下载的软件放在 ...

  8. CentOS Linux下编译安装MySQL

    本文参考张宴的Nginx 0.8.x + PHP 5.2.13(FastCGI)搭建胜过Apache十倍的Web服务器(第6版)[原创]完成.所有操作命令都在CentOS 6.4 64位操作系统下实践 ...

  9. Centos 6.5编译安装Nginx+php+Mysql

    说明: 操作系统:CentOS 6.5 64位 准备篇: 一.配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 二.配置防火墙,开启80端口.3306端口 vi /etc/sysconf ...

随机推荐

  1. php使用curl提交xml数据

    $xml_data ='<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_ ...

  2. android:分享 一个很强大的LOG开关---Log.isLoggable

    标签:android分享 一个很强大的log开 1.API亮点: 此API可以实现不更换APK,在出问题的手机上就直接能抓到有效log,能提升不少工作效率. 2.API介绍 最近在解决短信问题时,看到 ...

  3. js中将 整数转成字符,,将unicode 编码后的字符还原出来的方法。

    一.将整数转成字符: String.fromCharCode(17496>>8,17496&0xFF,19504>>8,19504&0xFF,12848> ...

  4. error=11, Resource temporarily unavailable

    问题1:Cannot run program "/bin/ls": error=11, Resource temporarily unavailable 1 15/04/22 14 ...

  5. javascript中的原型继承

    在Javascript面向对象编程中,原型继承不仅是一个重点也是一个不容易掌握的点.在本文中,我们将对Javascript中的原型继承进行一些探索. 基本形式 我们先来看下面一段代码: <cod ...

  6. Task 编程中的异常处理

    在 .Net 开发中, 使用 Task . Task<T> 进行异步编程是非常方便的, 但是在处理 Task 产生的异常时, 需要注意一个问题, 比如下面的代码: ? 1 2 3 4 5 ...

  7. 【HighCharts系列教程】四、颜色属性——colors

    一.Colors属性说明 配置Colors,可以自定义数据列的颜色. 默认下colors就包含一系列颜色,在个性化或需要调整颜色的顺序下,我们可以配置该属性. 二.colors属性详解 Colors属 ...

  8. USACO Section 1.1 Greedy Gift Givers 解题报告

    题目 问题描述 有若干个朋友,朋友之间可以选择互相赠送一些有价值的礼物.一个人可以选择将一部分钱分给若干个朋友,例如某人送给其他两个人钱,总共赠送3元,两个人平均分,原本应该是每人1.5元,但是只能取 ...

  9. 微信小程序实例教程(三)

    第七章:微信小程序编辑名片页面开发   编辑名片有两条路径,分为新增名片流程与修改名片流程. 用户手填新增名片流程:   首先跳转到我们的新增名片页面 1 需要传递用户的当前 userId,wx.na ...

  10. iOS WebView的用法

    一.UIWebView 可以加载和显示某个URL的网页,也可以显示基于HTML的本地网页或部分网页: a. 加载 URL WebView = [[UIWebView alloc] initWithFr ...