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. pythn os

    获取文件所在路径 import os os.path.dirname(__file__)  获取当前文件的所在路径 print (os.path.dirname(os.path.dirname(__f ...

  2. PHP更改自动加载的顺序

    composer的锅 自从PHPer们用上了composer后,对于传统的加载方式倒是不会用了,可谓是"收之东隅,失之桑榆". 下面说一下怎么改变加载顺序来覆写Laravel中的h ...

  3. 解决 meld 出现 locale.setlocale(locale.LC_ALL,'') 失败的问题

    . . . . . meld 是一款免费的文件比较工具,官网地址:http://meldmerge.org/ 在 Linux 环境使用 meld 的时候,可能会由于语言区域的配置问题导致它无法启动,会 ...

  4. Sass编译时Invalid US-ASCII character解决办法

    编译scss文件时,如果出现如下错误 Error: Invalid US-ASCII character "\xC2" on line 63 of src/assets/_scss ...

  5. mongo 删除内嵌数组元素

    文档格式如下: { "_id" : ObjectId("56e2a92ccc6dd2271953e502"), "links": [ { & ...

  6. 极速打包【shell版】

    同步发表至 http://avenwu.github.io/2014/12/16/fast_apk_release/ 前言 前阵子无意间看到美团的技术文章,一口气读了几篇java.android相关的 ...

  7. Wifi 开放系统认证和共享密钥身份认证

    记录开放系统认证和共享密钥认证的区别. 开放系统身份认证(open-systern authentication) 是802.11 要求必备的惟一方式. 由行动式工作站所发出的第一个帧被归类为auth ...

  8. 【03月04日】A股滚动市盈率PE历史新低排名

    2010年01月01日 到 2018年12月05日 之间,滚动市盈率历史新低排名. 上市三年以上的公司,2018年12月05日市盈率在300以下的公司. 1 - 青松股份(SZ300132) - 历史 ...

  9. vue跨域代理配置

    实际:http://a.com/b.php 代理:http://localhost/b.php 配置config/index.js proxyTable: { '/api': { target:'ht ...

  10. OpenGL——旋转的六边形(动画)

    代码: #include<iostream> #include <math.h> #include<Windows.h> #include <GL/glut. ...