1、配置编译环境

  1. yum update && yum upgrade
  2. yum groupinstall "Development Tools"

或者

  1. yum install gcc gcc-c++ pcre* openssl* gd-devel* zlib-devel pcre-devel libpcre3 libpcre3-dev zlib1g-dev unzip git

2、下载Nginx 1.8

  1. wget http://nginx.org/download/nginx-1.8.0.tar.gz

3、解压并进入目录

  1. tar -zxvf nginx-1.8..tar.gz
  2. cd nginx-1.8.

4、配置编译参数

简洁版

  1. ./configure

定制版(可根据生产要求定制需要的模块)

  1. ./configure \
  2. --prefix=/usr/local/nginx \
  3. --with-pcre \
  4. --with-http_ssl_module \
  5. --with-http_spdy_module \
  6. --with-http_realip_module \
  7. --with-http_addition_module \
  8. --with-http_sub_module \
  9. --with-http_auth_request_module \
  10. --with-http_stub_status_module \
  11. --with-http_image_filter_module \
  12. --with-http_gzip_static_module

编译成功会显示:

  1. Configuration summary
  2. + using system PCRE library
  3. + using system OpenSSL library
  4. + md5: using OpenSSL library
  5. + sha1: using OpenSSL library
  6. + using system zlib library
  7.  
  8. nginx path prefix: "/usr/local/nginx"
  9. nginx binary file: "/usr/local/nginx/sbin/nginx"
  10. nginx configuration prefix: "/usr/local/nginx/conf"
  11. nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  12. nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  13. nginx error log file: "/usr/local/nginx/logs/error.log"
  14. nginx http access log file: "/usr/local/nginx/logs/access.log"
  15. nginx http client request body temporary files: "client_body_temp"
  16. nginx http proxy temporary files: "proxy_temp"
  17. nginx http fastcgi temporary files: "fastcgi_temp"
  18. nginx http uwsgi temporary files: "uwsgi_temp"
  19. nginx http scgi temporary files: "scgi_temp"

5、安装

  1. make && make install

6、启动Nginx

  1. cd /usr/local/nginx/sbin/
  2. ./nginx

启动成功后可以使用netstat查看

  1. netstat -tunlp | grep nginx

7、停止Nginx

  1. /usr/local/nginx/sbin/nginx -s stop

或者

  1. pkill nginx

8、重启Nginx

  1. /usr/local/nginx/sbin/nginx -s reload

9、测试配置文件

  1. /usr/local/nginx/sbin/nginx -t

10、Nginx支持信号控制

  1. TERM, IN 快速关闭
  2. QUIT 从容关闭
  3. HUP 重载配置
  4. USR1 重新打开日志文件
  5. USR2 平滑升级可执行程序
  6. WINCH 从容关闭工作进程

例如,快速关闭Nginx

  1. kill -TERM (nginx PID)

CentOS 6.7 编译安装Nginx 1.8.0的更多相关文章

  1. centos 6.5 编译安装了 Nginx1.6.0+MySQL5.6.19+PHP5.5.14

    centos 6.5 编译安装了 Nginx1.6.0+MySQL5.6.19+PHP5.5.14--------------------------------------------------- ...

  2. Ubuntu 16.04源码编译安装nginx 1.10.0

    一.下载相关的依赖库 pcre 下载地址 http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.t ...

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

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

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

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

  5. centos 6 下编译安装 nginx

    下载nginx源码包,可以到nginx官方的下载文件归档里 http://nginx.org/download/ 下载 下载pcre源码,并编译安装,从pcre官方下载  ftp://ftp.csx. ...

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

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

  7. Centos 6.3 编译安装Nginx+php+Mysql

    1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables 将 -A INPUT -m state --state NEW -m tcp -p tcp --dpo ...

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

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

  9. centos 6.6编译安装nginx

    nginx 安装 安装前必要软件准备 1)安装pcre.gzip 等为了支持rewrite功能,我们需要安装pcre # yum install -y pcre* zlib zlib-devel op ...

随机推荐

  1. Mvc Model 模板的获取【学习笔记】

    MVC的Model模板有两种:一种编辑模式(@Html.EditorFor()).一种显示模式(Html.DisplayFor()). 模板的获取与执行(以下转自这里): 当我们调用HtmlHelpe ...

  2. Keil C51调试程序时, 对ROM的查看以及RAM 查看或修改

    在Keil 里使用 DeBug 模式时,如要 查看外部 RAM 的数据 或查看 ACC 的内容可以进行以下操作; sysGetTxMode: LCALL Com0185(C:2B95) ,sysGet ...

  3. QPainter类学习

    详细描述: QPainter类提供了许多高度优化的函数去做大部分的GUI绘制工作.它可以画从简单的线到复杂的形状.通常情况下,QPainter的使用是在widget当中的painter事件使用.记得在 ...

  4. 关于memory 和 cache

    这篇文章介绍了cache的相关知识,包括全相关.组相关.缓存与置换策略.WriteThrough和WriteBack策略.cache体系.CPUID和缓存一致性.介绍了两种缓存一致性的协议:snoop ...

  5. iconv

    iconv -f 源字符集 -t 目标字符集 文件名 iconv   -f UTF-8 -t GBK  success.msg [root@perass ~]# cat success.msg | t ...

  6. Learning WCF Chapter 3 Bindings One-Way and Duplex Communication

    One-Way and Duplex Communication A message exchange pattern describes the way messages are sent betw ...

  7. 【转】使用命令行方式创建和启动android模拟器

    原文网址:http://blog.csdn.net/tiandinilv/article/details/8953001 1.Android模拟器介绍 Android中提供了一个模拟器来模拟ARM核的 ...

  8. Activity声明周期容易出现的问题

    了解activity的生命周期,不仅仅是回答面试官的几个小问题:下面这篇文章不错,截取个人认为优秀的部分分享给大家,欢迎交流.感谢原作者 /** * 示例向我们展示了在 Activity 的配置改变时 ...

  9. python for selenium 数据驱动测试

    # -*- coding:utf-8 -*- """ 数据驱动测试,从 csv 文件中读取数据 """ from selenium impo ...

  10. selenium资料

    来源 http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/dotnet/Selenium.ISelenium.MouseMo ...