Nginx编译安装及编译参数讲解


实验环境说明:
操作系统:Centos 7 64位
Nginx版本:Nginx 1.12.2

编译安装前的准备
安装Nginx编译安装需要依赖的一些包
yum install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel open openssl-devel -y

#Nginx的编译安装及编译参数详解

Nginx的编译参数讲解
--prefix=PATH set installation prefix #设置安装路径
--sbin-path=PATH set nginx binary pathname #设置binary 路径
--conf-path=PATH set nginx.conf pathname #设置nginx 配置文件路径
--error-log-path=PATH set error log pathname #设置错误日志路径
--pid-path=PATH set nginx.pid pathname #设置nginx.pid 路径
--lock-path=PATH set nginx.lock pathname #设置nginx.lock路径

--user=USER set non-privileged user for #设置没有特殊权限的用户执行worker processes
worker processes
--group=GROUP set non-privileged group for #设置没有特殊权限的用户执行worker processes
worker processes

--builddir=DIR set build directory #设置编译目录

--with-rtsig_module enable rtsig module #开启rtsig 模块
--with-select_module enable select module #开启select 模块
--without-select_module disable select module #关闭 select 模块
--with-poll_module enable poll module #启用 poll 模块
--without-poll_module disable poll module #关闭poll 模块

--with-file-aio enable file AIO support #开启file AIO支持
--with-ipv6 enable IPv6 support #开启IPv6 支持

--with-http_ssl_module enable ngx_http_ssl_module #开启ssl 模块
--with-http_spdy_module enable ngx_http_spdy_module #开启spdy模块
--with-http_realip_module enable ngx_http_realip_module #开启 realip 模块
--with-http_addition_module enable ngx_http_addition_module #开启 addition 模块
--with-http_xslt_module enable ngx_http_xslt_module #开启 xslt模块
--with-http_image_filter_module enable ngx_http_image_filter_module #开启 image_filter模块
--with-http_geoip_module enable ngx_http_geoip_module #开启geoip模块
--with-http_sub_module enable ngx_http_sub_module #开启 sub模块
--with-http_dav_module enable ngx_http_dav_module #开启dav 模块
--with-http_flv_module enable ngx_http_flv_module #开启 flv模块
--with-http_mp4_module enable ngx_http_mp4_module #开启 mp4模块
--with-http_gunzip_module enable ngx_http_gunzip_module #开启gunzip模块
--with-http_gzip_static_module enable ngx_http_gzip_static_module #开启 gzip_static模块
--with-http_auth_request_module enable ngx_http_auth_request_module #开启 auth_request(身份验证请求)模块
--with-http_random_index_module enable ngx_http_random_index_module #开启random_index(随机指数)模块
--with-http_secure_link_module enable ngx_http_secure_link_module #开启 secure_link(安全链接)模块
--with-http_degradation_module enable ngx_http_degradation_module #开启degradation 模块
--with-http_stub_status_module enable ngx_http_stub_status_module #开启 stub_status 模块

--without-http_charset_module disable ngx_http_charset_module #关闭 charset(字符集) 模块
--without-http_gzip_module disable ngx_http_gzip_module #关闭 gzip模块
--without-http_ssi_module disable ngx_http_ssi_module #关闭 ssi 模块
--without-http_userid_module disable ngx_http_userid_module #关闭 userid模块
--without-http_access_module disable ngx_http_access_module #关闭 access模块
--without-http_auth_basic_module disable ngx_http_auth_basic_module #关闭 auth_basic (基本身份认证)模块
--without-http_autoindex_module disable ngx_http_autoindex_module #关闭 autoindex(自动变址)模块
--without-http_geo_module disable ngx_http_geo_module #关闭 geo模块
--without-http_map_module disable ngx_http_map_module #关闭 map 模块
--without-http_split_clients_module disable ngx_http_split_clients_module #关闭 split_clients (划分客户端)模块
--without-http_referer_module disable ngx_http_referer_module #关闭 referer (推荐人)模块
--without-http_rewrite_module disable ngx_http_rewrite_module #关闭 rewrite (重写)模块
--without-http_proxy_module disable ngx_http_proxy_module #关闭 proxy (代理)模块
--without-http_fastcgi_module disable ngx_http_fastcgi_module #关闭 fastcgi模块
--without-http_uwsgi_module disable ngx_http_uwsgi_module #关闭 uwsgi 模块
--without-http_scgi_module disable ngx_http_scgi_module #关闭 scgi 模块
--without-http_memcached_module disable ngx_http_memcached_module #关闭 memcached 模块
--without-http_limit_conn_module disable ngx_http_limit_conn_module # 关闭 limit_conn 模块
--without-http_limit_req_module disable ngx_http_limit_req_module #关闭 limit_req模块
--without-http_empty_gif_module disable ngx_http_empty_gif_module #关闭 empty_gif 模块
--without-http_browser_module disable ngx_http_browser_module #关闭 browser 模块
--without-http_upstream_ip_hash_module
disable ngx_http_upstream_ip_hash_module #关闭 ip_hash模块
--without-http_upstream_least_conn_module
disable ngx_http_upstream_least_conn_module #关闭 least_conn 模块
--without-http_upstream_keepalive_module
disable ngx_http_upstream_keepalive_module #关闭 keepalive 模块

--with-http_perl_module enable ngx_http_perl_module #开启perl 模块
--with-perl_modules_path=PATH set Perl modules path #设置perl模块路径
--with-perl=PATH set perl binary pathname #设置perl 命令路径

--http-log-path=PATH set http access log pathname #设置访问日志 路径
--http-client-body-temp-path=PATH set path to store
http client request body temporary files #设置存储路径 http客户端请求主体临时文件
--http-proxy-temp-path=PATH set path to store
http proxy temporary files #设置存储路径 http代理临时文件
--http-fastcgi-temp-path=PATH set path to store
http fastcgi temporary files #设置 fastcgi临时文件存储路径
--http-uwsgi-temp-path=PATH set path to store
http uwsgi temporary files #设置 uwsgi 临时文件存储路径
--http-scgi-temp-path=PATH set path to store
http scgi temporary files #设置 scgi 临时文件存储路径

--without-http disable HTTP server #关闭 http server
--without-http-cache disable HTTP cache #关闭 http cache

--with-mail enable POP3/IMAP4/SMTP proxy module #开启 POP3/IMAP4/SMTP 协议模块
--with-mail_ssl_module enable ngx_mail_ssl_module #开启 nginx mail ssl 模块
--without-mail_pop3_module disable ngx_mail_pop3_module #关闭 mail pop3模块
--without-mail_imap_module disable ngx_mail_imap_module #关闭 mail imap 模块
--without-mail_smtp_module disable ngx_mail_smtp_module #关闭 mail smtp 模块

--with-google_perftools_module enable ngx_google_perftools_module #开启 nginx google_perftools (谷歌性能工具)模块
--with-cpp_test_module enable ngx_cpp_test_module #开启 cpp_test 模块

--add-module=PATH enable an external module #开启external(外部)模块

--with-cc=PATH set C compiler pathname #设置C 编译器 路径
--with-cpp=PATH set C preprocessor pathname #设置 C预编译器 路径
--with-cc-opt=OPTIONS set additional C compiler options #设置额外的C编译器选项
--with-ld-opt=OPTIONS set additional linker options #设置额外的链接器选项
--with-cpu-opt=CPU build for the specified CPU, valid values:
pentium, pentiumpro, pentium3, pentium4,
athlon, opteron, sparc32, sparc64, ppc64 #建立指定的CPU 有效值:

--without-pcre disable PCRE library usage #关闭 PCRE 库 使用
--with-pcre force PCRE library usage #强制使用指定的PCRE 库
--with-pcre=DIR set path to PCRE library sources #指定 pcre 使用路径
--with-pcre-opt=OPTIONS set additional build options for PCRE #为PCRE设置额外的构建选项
--with-pcre-jit build PCRE with JIT compilation support #构建PCRE JIT编译的支持

--with-md5=DIR set path to md5 library sources #设置路径md5库资源
--with-md5-opt=OPTIONS set additional build options for md5 #为md5设置额外的构建选项
--with-md5-asm use md5 assembler sources #使用md5汇编源

--with-sha1=DIR set path to sha1 library sources #设置 sha1 库的路径
--with-sha1-opt=OPTIONS set additional build options for sha1 #为sha1设置额外的构建选项
--with-sha1-asm use sha1 assembler sources #使用sha1汇编源

--with-zlib=DIR set path to zlib library sources #指定 zlib 库的路径
--with-zlib-opt=OPTIONS set additional build options for zlib #为zlib 设置额外的构建选项
--with-zlib-asm=CPU use zlib assembler sources optimized
for the specified CPU, valid values:
pentium, pentiumpro #使用 zlib汇编优化的来源

--with-libatomic force libatomic_ops library usage #强制 使用libatomic
--with-libatomic=DIR set path to libatomic_ops library sources #设置 libatomic 路径

--with-openssl=DIR set path to OpenSSL library sources #设置 openssl 库的路径
--with-openssl-opt=OPTIONS set additional build options for OpenSSL #为 openssl 设置额外的构建选项

--with-debug enable debug logging #开启debug 日志

Nginx的编译步骤:
一、执行nginx源码包中的configure脚本
解压nginx的源码包,进入nginx源码包解压后的目录中,执行configure脚本,生成makefile文件。
我在生成makefile文件时,使用以下编译参数
./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --with-debug

二、使用make命令和make install命令进行编译安装
make && make install

到此为止,我们我们的nginx程序就安装好了。

原文地址:http://blog.51cto.com/3037673/2289528

时间: 2024-08-16 02:36:03

Nginx编译安装及编译参数讲解的相关文章

Linux下nginx编译安装教程和编译参数详解

这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # yum install pcre* //如过你已经装了,请跳过这一步 2.安装openssl 需要ssl的支持,如果不需要ssl支持,请跳过这一步 复制代码代码如下: # yum install openssl* 3.gzip 类库安装 复制代码代码如下: yum install zlib zlib-

Nginx的安装与初步讲解

Nginx的安装与初步讲解 1.2 Nginx的基本编译安装:编译安装前的准备:安装Nginx编译安装需要依赖的一些包[[email protected] ~]## yum install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel open openssl-devel -y 切换到存放nginx源码包的目录:使用源码包中的configure脚本 生成makefile文件.configure脚本支持以下选项:--help print

使用本脚本可以自动批量完成中间节点环境的部署工作,包括:Nginx编译安装、添加程序管理脚本、设置开机启动、反向代理配置、证书分发、添加iptables规则等

使用本脚本可以自动批量完成中间节点环境的部署工作,包括:Nginx编译安装.添加程序管理脚本.设置开机启动.反向代理配置.证书分发.添加iptables规则等.脚本支持自定义nginx安装版本.设置编译模块.配置监听端口等. 1. Nginx Role规则说明 本脚本用于中间节点(Nginx反向代理)环境的自动化配置,主要内容包括: 安装基础依赖环境: 创建nginx启动用户(支持自定义用户): 下载nginx安装文件(可自定义nginx版本): 解压安装文件: 执行编译安装(可自定义编译参数和

Nginx编译安装,启动,停止,升级。

1.简单介绍下Nginx Nginx是一款轻量级的web服务器和反向代理服务器,它使用了epoll的I/O模型,也就是事件触发I/O模型,减少了进程的生成切换所消耗的系统资源(CPU的压力减少,内存的占用也会减少),可以达到很高的并发请求.它是一款开源软件,企业成本降低,它的使用配置也比较简单,同时支持Rewrite,作为反向代理的时候可以检查后端的Web服务器的健康状况,能够支持热部署. 2.Nginx安装,重启,升级,停止. 环境是Centos系统,通过www.nginx.org下载需要的源

NGINX编译安装后添加新模块的方法

刚忙完研发又有新的需求过来,测试服务器的nginx需要有HttpUpstreamRequestHashModule和HttpStubStatusModule:擦!安装软件环境时怎么不说清楚:妹的,悲剧. 测试服务器崩溃的是不是我安装的软件,天啊.赶紧搞吧!!! 环境:centos 6.4 64位 编译安装nginx 1:查看nginx版本和安装时间带的具体参数  /usr/local/nginx/sbin/nginx  -V 2:下载相应的版本的nginx源码包[nginx-1.5.11.tar

nginx 编译安装 及错误解决。

nginx 编译安装 Nginx 是一个很强大的高性能Web和反向代理服务器,它具有很多非常优越的特性:在连接高并发的情况下,Nginx是Apache服务器不错的替代品:Nginx在美国是做虚拟主机生意的老板们经常选择的软件平台之一.能够支持高达 50,000 个并发连接数的响应.相比apache nginx处理静态页面更加优秀迅速,配置也相当简洁明了. nginx相对于apache的优点: 轻量级,同样起web 服务,比apache 占用更少的内存及资源 抗并发,nginx 处理请求是异步非阻

Nginx编译安装Lua模块

Nginx编译安装Lua模块 一.安装Lua环境及相关库 官网网址:https://github.com/openresty/lua-nginx-module LuaJIT ` wget http://luajit.org/download/LuaJIT-2.0.2.tar.gz make install PREFIX=/usr/local/LuaJIT export LUAJIT_LIB=/usr/local/LuaJIT/lib export LUAJIT_INC=/usr/local/Lu

nginx编译安装on mac

一.编译安装模块 如果是原有包中就有的模块,编译时, ./configure --with-xxx 就可以, 如果是第三方模块,可使用 --add-module, 如果有多个模块的话,只需要多次使用-add-module指令即可. 二.下载源码包image_fliter和echo模块 nginx源码下载 http://nginx.org/en/download.html echo模块下载 https://github.com/openresty/echo-nginx-module/tags 解压

[linux] Nginx编译安装错误error: the HTTP rewrite module requires the PCRE library

nginx编译错误: 执行如下命令安装缺少的文件即可