nginx通过rpm包进行的安装和配置:

[web][nginx] 初识nginx -- 使用nginx搭建https DPI解码测试环境

现在,要通过源码进行安装。

参考:https://nginx.org/en/docs/configure.html

1. 下载PCRE-8.41   https://ftp.pcre.org/pub/pcre/ 并解压。

2.  安装 zlib

yum install zlib-devel

3.  configure

root@D128 ~/S/nginx-1.13.# ./configure --prefix=/root/BUILD --with-pcre=/root/Src/pcre-8.41/
root@D128 ~/S/nginx-1.13.9# make

4.  安装

root@D128 ~/S/nginx-1.13.# make install

安装完了,在这里

root@D128 ~/BUILD# ls
client_body_temp/ conf/ fastcgi_temp/ html/ logs/ proxy_temp/ sbin/ scgi_temp/ uwsgi_temp/

5. 启动,

执行这个程序,就会用默认配置启动了。

/root/BUILD/sbin/nginx

但是,关掉iptables,selinux之后,依然报错

// :: [error] #: * "/root/BUILD/html/index.html" is forbidden (: Permission denied), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "127.0.0.1"
// :: [error] #: * "/root/BUILD/html/index.html" is forbidden (: Permission denied), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "127.0.0.1"

原来是因为我放在了 /root/目录下,root的目录权限导致了这个问题。

root@D128 /# chmod  root/

6 GDB

默认编译文件objs/Makefile就是-g的,所以默认就能gdb

https://www.ibm.com/developerworks/cn/linux/l-cn-gdbmp/

(gdb) set follow-fork-mode child

在fork后的子进程中设置断点:

(gdb) b ngx_daemon.c:
Breakpoint at 0x42f014: file src/os/unix/ngx_daemon.c, line .

nginx的进程启动大流程: (配置文件的初始化在第一次fork之前进行。)

7. loction

http://nginx.org/en/docs/http/ngx_http_core_module.html#location

今天重点研究的侧重点是location与pcre的问题,用来提升7层LB的性能。

现在,要搞清楚下面两个函数的调用契机和逻辑

ngx_http_core_find_config_phase

    ngx_http_core_find_location 调用了 PCRE (ngx_http_regex_exec -> pcre_exec)

ngx_http_core_location

    ngx_http_core_regex_location 调用了PCRE (ngx_http_regex_compile)

从如下代码中可以发现,该ngx_http_core_location函数用于做location关键字的配置

src/http/ngx_http_core_module.c: line 273

      { ngx_string("location"),
NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE12,
ngx_http_core_location,
NGX_HTTP_SRV_CONF_OFFSET,
,
NULL },

[nginx] 从源码编译安装NGINX的更多相关文章

  1. CentOS7 源码编译安装Nginx

    源码编译安装nginx     1.下载nginx源码包(这里以nginx-1.18.0为例) wget http://nginx.org/download/nginx-1.18.0.tar.gz 2 ...

  2. 源码编译安装nginx及设置开机启动项

    1.上传nginx文档:解压到/data目录下,并安装依赖包tar xf nginx-1.20.1.tar.gz -C /data/cd /data/nginx-1.20.1/ && ...

  3. Linux系统 - 源码编译安装Nginx

    什么是Nginx? Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器,在高连接并发的情况下N ...

  4. Centos7通过yum跟源码编译安装Nginx

    源码编译安装 http://nginx.org/en/download.html 到官网下载,然后用XFTP上传到root目录 把文件解压出来 tar -zxvf nginx-1.16.0.tar.g ...

  5. 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 ...

  6. 源码编译安装nginx

    安装依赖软件 1.安装编译工具gcc gcc是一个开源编译器集合,用于处理各种各样的语言:C.C++.Java.Ada等,在linux世界中是最通用的编译器,支持大量处理器:x86.AMD64.Pow ...

  7. Centos6.5源码编译安装nginx

    1.安装pcre下载地址:http://jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz #tar -axvf pcre ...

  8. CentOS 7 源码编译安装 Nginx

    这里安装的是nginx 1.14版本 1.下载源码 #下载 wget http://nginx.org/download/nginx-1.14.0.tar.gz #解压 tar -xzf nginx- ...

  9. CentOS中源码编译安装Nginx

    1.从官网通过wget命令将Nginx源码包下载到Linux上 ​ Nginx下载页面:http://nginx.org/en/download.html 2.在Linux上安装需要依赖的环境 yum ...

随机推荐

  1. sublime text 3 环境变量的配置、安装Package Control、汉化和注册

    1.在运行里输入sysdm.cpl打开环境变量设置界面,输入sublime的安装目录,分号和之前的隔开 2.下载好Package Control,解压重命名为package control 下载地址: ...

  2. ESXi创建磁盘命令

    [root@esx421 SAN]# vmkfstools -d thick -a lsilogic -c 10G lun00.vmdk Incorrect disk option "thi ...

  3. Oralce 日期操作

    1.日期比较 --1.在确定时间之前: select * from up_date where update < to_date('2018-06-05 00:00:00','yyyy-mm-d ...

  4. 【iCore4 双核心板_ARM】例程十五:USB_CDC实验——高速数据传输

    实验方法: 1.安装USB CDC驱动,驱动安装方法参考例程包中安装方法文档. 2.将跳线冒跳至USB_OTG,通过Micro USB 线将iCore4 USB-OTG接口与电脑相连. 3.打开上位机 ...

  5. 【javascript】利用 a 标签自动解析 url

    很多时候,我们有从 url 中提取域名,查询关键字,变量参数值等的需求,然而我们可以让浏览器方便地帮助我们完成这一任务而不用写正则去抓取.方法就是先创建一个 a 标签然后将需要解析的 url 赋值给  ...

  6. RedisLive监控工具 windows部署笔记

    1. Python2.7环境安装  Path环境变量中添加  2.下载安装 VC Compiler for Python  地址: http://www.microsoft.com/en-us/dow ...

  7. 浅析C#中的结构体和类

    类和结构是 .NET Framework 中的常规类型系统的两种基本构造. 两者在本质上都属于数据结构.封装着一组总体作为一个逻辑单位的数据和行为. 数据和行为是该类或结构的"成员" ...

  8. Python 中的map、reduce函数用法

    #-*- coding:UTF-8 -*- #map()函数接受两个参数,一个是函数,一个是序列,map将传入的函数依次作用到序列的每个元素,并把结果作为新的list返回 def f(x): retu ...

  9. [GAN] Generative networks

    中文版:https://zhuanlan.zhihu.com/p/27440393 原文版:https://www.oreilly.com/learning/generative-adversaria ...

  10. SpringBoot(十四)-- 整合Swagger2

    1.pom依赖 <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-s ...