Nginx编译参数配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/longgeqiaojie304/article/details/84978430

Nginx编译参数配置

三大块讲解:

  • 安装目录
  • 编译参数
  • Nginx基本配置语法

1、查看安装编译参数命令

nginx -V

--with开头的表示模块

--with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt

2、安装编译参数详解

(1)安装target目录或路径

以下所有的都是nginx的基础路径:

--prefix=/etc/nginx表示nginx主目录

--prefix=/etc/nginx表示命令执行目录

--modules-path=/usr/lib64/nginx/modules表示nginx模块目录

--conf-path=/etc/nginx/nginx.conf表示nginx配置文件目录

--error-log-path=/var/log/nginx/error.log表示错误日志打印目录

--http-log-path=/var/log/nginx/access.log表示nginx访问日志目录

--pid-path=/var/run/nginx.pid表示nginx执行进程目录

--lock-path=/var/run/nginx.lock表示nginx锁目录

(2)执行对应模块时,Nginx保留的临时性文件

以下都是各模块临时性缓存文件存放路径:

--http-client-body-temp-path=/var/cache/nginx/client_temp

--http-proxy-temp-path=/var/cache/nginx/proxy_temp

--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp

--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp

--http-scgi-temp-path=/var/cache/nginx/scgi_temp

(3)设置nginx进程启动的用户和用户组

Nginx启动编译的时候是以nginx用户的权限执行的

Nginx启动的时候是用root用户执行的,但是nginx worker进程是用nginx用户跑的

不用root用户主要是基于安全考虑

(4)设置额外的参数将被添加到CFLAGS变量

懂C语言编译的同学可能更了解一点;

通过C语言编译器编译的时候,会把这里设置的parameters参数添加到CFLAGS变量里面;

如果我们使用的是select模型的话,我们可以通--with-cc-opt=xxx设置最大文件句柄数;

对于现在来说,我们可以不用了解太多;

(5)设置附加的参数,链接系统库

把设置的一些parameters参数添加到ld变量里面;

如果我们编译的时候需要pcre库的时候,可以--with-ld-opt=xxx设置,通过这种方式就可以找到相对应的库;

这是nginx添加xxx库的一种方式,其实nginx还有其他的方式可以实现;

 

猜你喜欢

转载自blog.csdn.net/longgeqiaojie304/article/details/84978430
今日推荐