nginx 编译安装详解
2016-06-28 00:00
429 查看
nginx 编译安装
===================
编译自:
http://nginx.org/en/docs/install.html
如果需要特别的 nginx 功能,可进行编译安装:
源码包中提供 configure 脚本用于编译前定义 nginx 各方面的配置。
执行 configure 脚本最后生成 Makefile,make 命令根据 Makefile 进行编译安装。
configure 命令支持如下参数:
Example of parameters usage (all of this needs to be typed in one line):
配置完成后,使用 make 命令编译安装 nginx。
===================
编译自:
http://nginx.org/en/docs/install.html
如果需要特别的 nginx 功能,可进行编译安装:
源码包中提供 configure 脚本用于编译前定义 nginx 各方面的配置。
执行 configure 脚本最后生成 Makefile,make 命令根据 Makefile 进行编译安装。
configure 命令支持如下参数:
[code=language-bash]--prefix=path 定义 nginx 文件的安装路径。 configure 的其他选项如果使用相对路径,那么以此路径为基础路径。(except for paths to libraries sources)。nginx.conf 文件中的相对路径也以此为基础路径。 默认 --prefix=/usr/local/nginx --sbin-path=path 设置 nginx 二进制程序的路径名,这个名字只在安装期间使用。 默认 --sbin-path=prefix/sbin/nginx --conf-path=path 设置 nginx.conf 的路径。 nginx 可在启动时手动以 -c file 参数指定其他配置文件。 默认 --conf-path=prefix/conf/nginx.conf --pid-path=path 设置 nginx.pid 文件的路径。安装nginx之后,可在 nginx.conf 文件中使用 pid 指令修改该路径。 默认 --pid-path=prefix/logs/nginx.pid --error-log-path=path 设置 nginx 错误日志的路径。安装nginx之后,可在 nginx.conf 文件中使用 error_log 指令修改该路径。 默认 --error-log-path=prefix/logs/error.log. --http-log-path=path 设置 nginx 访问日志的路径。安装nginx之后,可在 nginx.conf 文件中使用 access_log 指令修改该路径。 默认 --http-log-path=prefix/logs/access.log --user=name 设置启动 worker 进程时所使用的非特权用户名。安装nginx之后,可在 nginx.conf 文件中使用 user 指令修改用户名。 默认 --user=nobody --group=name 设置启动 worker 进程时所使用的非特权用户组名。安装nginx之后,可在 nginx.conf 文件中使用 group 指令修改用户组名。 默认 --group=nobody --with-select_module --without-select_module 是否编译 select 模块。使用 select 模块可使 nginx 工作于 select() 模式。 如果 nginx 不支持其他更合适的模块,如 kqueue, epoll 或者 /dev/poll,该模块被自动编译。 --with-poll_module --without-poll_module 是否编译 poll 模块。使用 poll 模块可使 nginx 工作于 poll() 模式。 如果 nginx 不支持其他更合适的模块,如 kqueue, epoll 或者 /dev/poll,该模块被自动编译。 --without-http_gzip_module 不编译 gzip 压缩模块。压缩模块用于压缩 HTTP 响应报文。该模块的编译和运行依赖 zlib 库。 --without-http_rewrite_module 不编译 rewrite 模块。rewrite 模块用于重定向 HTTP 请求,也可以改写 HTTP 请求的 URI。 该模块的编译和运行依赖 PCRE 库。 --without-http_proxy_module 不编译 proxy 模块。 --with-http_ssl_module 编译 ssl 模块。ssl 模块使 nginx 支持 HTTPs 协议。该模块默认不编译。 该模块的编译和运行依赖 OpenSSL 库。 --with-pcre=path 设置 PCRE 库的源码路径。首先需要下载和解压 PCRE 库:http://www.pcre.org。 要求 PCRE 的版本范围为 4.4 — 8.38。 设置之后,其余的就交给 ./configure 和 make 命令。 nginx 使用 PCRE 库用于支持正则表达式。正则表达式在 location 指令和 rewrite 模块中会用到。 --with-pcre-jit 编译 PCRE 库时,加入 “just-in-time compilation” 支持 (1.1.12, the pcre_jit directive) --with-zlib=path 设置 zlib 库的源码路径。首先需要下载和解压 zlib 库:http://zlib.net 要求 zlib 库的版本范围为 1.1.3 — 1.2.8 设置之后,其余的就交给 ./configure 和 make 命令。 gzip 压缩模块依赖 zlib 库。 --with-cc-opt=parameters 为 CFLAGS 变量设置额外的参数。 比如 FreeBSD 下使用 PCRE 库,必须指定 --with-cc-opt="-I /usr/local/include" 比如 希望增加 select() 支持的文件数,可指定:--with-cc-opt="-D FD_SETSIZE=2048" --with-ld-opt=parameters 设置链接时的额外参数。 比如,FreeBSD 使用 PCRE 库时,必须指定 --with-ld-opt="-L /usr/local/lib"。
Example of parameters usage (all of this needs to be typed in one line):
[code=language-bash]./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=../pcre-8.38 --with-zlib=../zlib-1.2.8
配置完成后,使用 make 命令编译安装 nginx。
相关文章推荐
- nginx 编译安装实践
- nginx模块描述,模块分类,处理流程
- 安装nginx+php
- 【转载】“惊群”,看看nginx是怎么解决它的
- 查看Nginx、apache、MySQL和PHP的编译参数
- 使用Nginx+Lua代理Hadoop HA
- nginx HA and 负载均衡示意图
- nginx基于IP的虚拟主机配置
- nginx基于端口的虚拟主机配置
- 配置nginx状态信息虚拟主机
- 配置nginx的独立虚拟主机文件
- ubuntn 配置webpy nginx
- Python的Flask框架及Nginx实现静态文件访问限制功能
- nginx location 匹配规则
- 让nginx支持pathinfo
- 从流程解析Nginx对 Native aio支持
- Nginx出现413 Request Entity Too Large错误解决方法
- zabbix 监控nginx
- 解决nginx bind() to 0.0.0.0:80 failed 问题
- nginx 分别对各个域名跳转