Nginx浅谈

本文介绍了Nginx的secure_link_module模块及其配置语法,包括secure_link和secure_link_md5指令。讨论了Nginx的下载链接验证方式,如md5加密和过期时间检查。接着提到了Nginx与Tomcat在功能和性能方向上的比较,并概述了如何源码编译Nginx及性能测试。此外,还讲解了在CentOS上安装Nginx的扩展,平滑重启Nginx的方法,以及配置文件的语法检查。最后,文章预告了后续将深入探讨Nginx高并发实现、epoll模型和不同I/O模型的对比。
摘要由CSDN通过智能技术生成

secure_link_module模块

定制并且允许检查请求的连接的真实性以及保护资源免遭未经授权的访问

限制链接生效周期

相关配置语法

syntax:secure_link expression;
Default:————
Context:http,server,location

syntax:secure_link_md5 expression;
Default:————
Context:http,server,location

验证的方式
在这里插入图片描述/downloadmd5=(加密)&expire=(加密)
md5加密,expire过期校验

nginx性能调优

nginx web静态 反向代理(负载均衡)lvs、haproxy重量级 静态缓存服务器(varnish、squid)一般不使用Nginx做静态缓存 

nginx tomcat:功能方向 性能方向

源码编译Nginx及其性能测试工具

yum -y install pcre pcre-devel  # 安装pcre库是为了支持Nginx HTTP Rewrite模块

yum -y install openssl openssl-devel gcc-c++ gcc -y
<1> 源码编译检测工具
tar -xf gperftools-2.4.tar.gz
cd gperftools-2.4
./configure --prefix=/usr/local/ --enable-frame-pointers
make && make install 


<2> 将Nginx-http-concat模块放到Nginx的源码目录下
useradd nginx


<3> 源码编译Nginx
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --http-log-path=/log/access.log --error-log-path=/log/error.log --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --add-module=nginx-http-concat --with-google_perftools_module
make && make install

<4> 启动nginx
./usr/local/nginx/sbin/nginx
报错:
./nginx: error while loading shared libraries: libprofiler.so.0: cannot open shared object file: No such file or directory  # 无法找到我们之前指定的库文件

解决方案:
vim /etc/ld.so.conf.d/gperftools.conf
    /usr/local/lib/
ldconfig        #重载我们的系统配置文件
nginx -V        #查看当前的Nginx开启的模块

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值