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

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程序就安装好了。

转载于:https://blog.51cto.com/3037673/2289528

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值