Nginx基础入门篇(2)—编译参数介绍

查看命令

nginx -V
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx
--sbin-path=/usr/sbin/nginx
--modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock
--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
--user=nginx --group=nginx --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='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC'
--with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'

configure arguments #配置参数./configure –help查询帮助

–prefix=/etc/nginx #安装路径

–sbin-path=/usr/sbin/nginx #程序文件

–modules-path=/usr/lib64/nginx/modules #模块路径

–conf-path=/etc/nginx/nginx.conf #主配置文件

–error-log-path=/var/log/nginx/error.log #错误日志

–http-log-path=/var/log/nginx/access.log #访问日志

–pid-path=/var/run/nginx.pid #程序ID

–lock-path=/var/run/nginx.lock #锁路径,防止重复启动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 #php缓存

–http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp #python缓存

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

–with-compat #启用动态模块兼容性

–user=nginx #用户

–group=nginx #组

–with-file-aio #使用nginx的aio特性会大大提高性能,比如图片站的特点是大量的读io操作

nginx aio不用等待每次io的结果,有助于并发处理大量io和提高nginx处理效率。

aio的优点就是能够同时提交多个io请求给内核,然后直接由内核的io调度算法去处理这些请求(directio)

这样的话,内核就有可能执行一些合并,节约了读取文件的处理时间。

就是异步非阻塞

–with-threads #多线程模块

–with-http_addition_module #响应之前或者之后追加文本内容,比如想在站点底部追加一个js广告或者新增的css样式

例如:

nginx配置addition

配置nginx.conf
server {
listen 80;
server_name www.ttlsa.com;

root /data/site/www.ttlsa.com;

location / {
add_before_body /2013/10/header.html;
add_after_body /2013/10/footer.html;
}
}

测试
以下三个文件,对应请求的主体文件和add_before_body、add_after_body对应的内容
cat /data/site/test.ttlsa.com/2013/10/20131001_add.html

ngx_http_addition_module

cat /data/site/test.ttlsa.com/2013/10/header.html
I am header!

cat /data/site/test.ttlsa.com/2013/10/footer.html
footer – ttlsa

访问结果如下,可以看到20131001_add.html的顶部和底部分别嵌入了子请求header.html和footer的内容。
curl test.ttlsa.com/2013/10/20131001_add.html
I am header!

ngx_http_addition_module

footer – ttlsa

–with-http_auth_request_module # 认证模块

–with-http_dav_module #增加上传PUT,DELETE,MKCOL:创建集合,COPY和MOVE方法)默认情况下为关闭

–with-http_flv_module #NGINX 添加MP4、FLV视频支持模块

–with-http_gunzip_module #压缩模块

–with-http_gzip_static_module

–with-http_mp4_module #多媒体模块

–with-http_random_index_module #nginx显示随机首页模块

–with-http_realip_module #Nginx获取真实IP模块

–with-http_secure_link_module #nginx安全下载模块

–with-http_slice_module #nginx中文文档

–with-http_ssl_module #安全模块

–with-http_stub_status_module #访问状态

–with-http_sub_module #nginx替换网站响应内容

–with-http_v2_module

–with-mail #邮件客户端

–with-mail_ssl_module

–with-stream #负载均衡模块。nginx从1.9.0开始,新增加了一个stream模块,用来实现四层协议的转发、代理或者负载均衡等。

–with-stream_realip_module

–with-stream_ssl_module

–with-stream_ssl_preread_module

CPU优化参数

–with-cc-opt=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong —
param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC’
–with-ld-opt=’-Wl,-z,relro -Wl,-z,now -pie’

Original: https://www.cnblogs.com/Jqazc/p/16693724.html
Author: 我真的兔了
Title: Nginx基础入门篇(2)—编译参数介绍

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/578405/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • 使用MyBatis Generator代码生成器的简单模式

    在动态web项目的lib目录下放入mybatis-3.2.2jar、mysql-connector-java-5.1.25-bin.jar、log4j-1.2.17.jar还有生成…

    Linux 2023年6月8日
    0117
  • 【Ubuntu】如何将Ubuntu软件源切换到国内源?

    为什么切换软件源? 当初次部署Ubuntu镜像时,会发现更新软件时速度非常慢,因为Ubuntu的软件都来自与国外,所下载或更新软件时的速度非常慢,此时就可以选择切换到国内的软件源来…

    Linux 2023年6月13日
    0100
  • python入门基础知识四(字典与集合)

    dict_name = {key1:value1,key2,value2,…} 空字典:dict_name = {} or dict_name = dict() 字典的…

    Linux 2023年6月7日
    070
  • 这 BUG,绝了

    上周只上了三天班,但我也丝毫不敢懈怠,BUG 更是一个也没少写。 看着满屏幕的 ERROR,我陷入沉思。为什么我写的代如此烂,无法像大牛们写的那般优雅? 越想越自卑,越想越抑郁。我…

    Linux 2023年6月7日
    0105
  • 字节 字符 位(比特)

    位(bit):binary digit,计算机储存的最小单位,n个比特可以确定2^n个情况,如11010100为8位。 字节(byte):一个字节储存8位无符号数,范围为0-225…

    Linux 2023年6月13日
    0104
  • Ubuntu更换镜像源

    当修改 sources.list文件时,我们需要将下面任意一个镜像源的代码 复制粘贴到该文件中。 阿里源 阿里镜像源 deb http://mirrors.aliyun.com/u…

    Linux 2023年6月14日
    093
  • 远程小工具PuTTY

    镜像下载、域名解析、时间同步请点击阿里云开源镜像站 PuTTY是一个Telnet、SSH、rlogin、纯TCP以及串行接口连接软件。我们连接服务器一般用ssh或者telnet,这…

    Linux 2023年5月27日
    0101
  • 为Windows Service 2019 使用 Docker

    引言最近收到领导通知,甲方需要将原来的服务器迁移到新的服务器。原来的服务器上安装了很多的服务,每次重启之后总是有很多的问题需要人工大量的进行干预。这次迁移的还是Windows服务器…

    Linux 2023年6月14日
    0114
  • linux三剑客之awk

    linux三剑客之awk 适用范围:awk主要是用来格式化文本。 语法格式:awk [参数] [处理规则] [操作对象] 参数 作用 -F 指定文本分隔符(不写默认是以空格作为分隔…

    Linux 2023年5月27日
    0108
  • 渗透测试常用方法总结

    转载自 https://blog.csdn.net/qq_42636435/article/details/92839738 Original: https://www.cnblo…

    Linux 2023年6月7日
    076
  • redis缓存数据库简单使用

    1、在Linux上安装与配置 -最新:7.0 -最稳定版本:6.x-讲课:5.x-企业里:3.x,4.x,5.x 6.x(极少数公司在用)-windows:3.x,5.x 1 速度…

    Linux 2023年6月14日
    095
  • Linux 中 图片的产生与查看

    使用场景 当在 Linux 的控制台想要显示一张图片,使用matplotlib.plt.plot() 和matplotlib.plt.show() 会报错。此时可以曲线救国,不直接…

    Linux 2023年6月7日
    077
  • 【Redis】缓存穿透、缓存击穿、缓存雪崩产生原因及解决方案

    一. 本文对Redis中[缓存穿透]、[缓存击穿]、[缓存雪崩]三种现象产生原因、解决方法进行说明 二. 缓存穿透 1. 原因 2. 解决方法 三. 缓存击穿 1. 原因 2. 解…

    Linux 2023年5月28日
    0106
  • 项目经验示例

    一,期中项目经验示例 1,根据现有结构部署工具(PXE+kickstart)2,结合应用系统需求定制部署模版3,制作系统优化等一键执行脚本4,自动化部署实施5,根据定制的优化内容对…

    Linux 2023年6月7日
    089
  • 位图

    例题1 给40亿个不重复的无符号整数,没排过序。给一个无符号整数,如何快速判断一个数是否在 这40亿个数中。 首先肯定不能用传统的int数据存储 因为内存不够 40亿的整数大概为1…

    Linux 2023年6月13日
    086
  • Linux 常用命令总结(三)

    一、实用命令 1、crontab(定时任务) (1)基本概念crontab 是用来管理定时任务的命令。系统启动后,将会自动调用 crontab,如果存在任务,则根据相关定义去执行。…

    Linux 2023年5月27日
    0117
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球