随笔分类 - nginx
摘要:2019-12-09云端CDN rewrite规则: 登录后复制 ^/.{6}[0-9]{8}/([0-9]{2})_([0-9]{2})/([0-9]+)(png|jpeg|jpg|gif)(.*)$ /uploads/picture/2016/$1/$2/$3.$4$5 ^/.{6}[0-9]{
阅读全文
摘要:线上的CDN厂商的nginx的rewrite规则配置验证 环境介绍: [root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) nginx服务是编译安装: 登录后复制 yum install -y
阅读全文
摘要:在nginx的站点配置文件中使用了rewrite,检查rewrite规则确定是没问题,但是在rewrite中带有"{}"时,此时检查nginx语法报错 ** rewrite规则:** 登录后复制 [root@test01 ~]# grep rewrite /usr/local/nginx/conf/
阅读全文
摘要:一、概述 需求:所有访问/webapi/**的请求必须是GET请求,而且根据请求参数过滤不符合规则的非法请求(黑名单),可以返回具体的http状态码,提示客户端IP被列入黑名单,遭到请求的限制 实现思路:通过在Nginx上进行访问限制,通过Lua来灵活实现业务需求,而Redis用于存储黑名单列表。
阅读全文
摘要:一、概述 需求:所有访问/webapi/**的请求必须是POST请求,而且根据请求参数过滤不符合规则的非法请求(黑名单), 这些请求一律不转发到后端服务器(Tomcat) 实现思路:通过在Nginx上进行访问限制,通过Lua来灵活实现业务需求,而Redis用于存储黑名单列表。 二、具体实现 1.lu
阅读全文
摘要:实现过程: nginx+redis +lua的环境,前一篇博文已经部署好 在服务器上安装好redis后,记得要安装php的redis扩展,由于开发语言是php,所以要安装redis的扩展,这样才能php程序操作redis, php脚本存入key到redis中,通过请求url来实现nginx 302跳
阅读全文
摘要:一、功能实现介绍: 使用Redis做分布式缓存;使用lua API来访问redis缓存;使用nginx向客户端提供服务,ngx_lua将lua嵌入到nginx,让nginx执行lua脚本,高并发,非阻塞的处理各种请求。url请求nginx服务器,然后lua查询redis,返回json数据。 二、服务
阅读全文
摘要:nginx + php-fpm fastcgi防止跨站、跨目录的安全设置 参考博文: https://www.iamle.com/archives/1609.html 使用open_basedir可以限制程序可操作的目录和文件,提高系统安全性。但会影响I/O性能导致系统执行变慢,因此需要根据具体需求
阅读全文
摘要:nginx: 400 Bad Request | The plain HTTP request was sent to HTTPS port nginx 版本nginx/1.12.2 在nginx环境下使用ssl链接出现问题400错误 nginx配置文件如下: 访问https时候正常,不过直接访问的
阅读全文
摘要:http://www.onexin.net/rewrite.php
阅读全文
摘要:cat /usr/local/nginx/conf/nginx.conf 登录后复制 user www www; worker_processes auto; error_log /home/wwwlogs/nginx_error.log crit; pid /usr/local/nginx/log
阅读全文
摘要:cat /usr/local/nginx/conf/agent_deny.conf 登录后复制 if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners
阅读全文
摘要:Nginx模块 ngx_http_limit_conn_module 限制连接数 参考地址: http://blog.csdn.net/loophome/article/details/50766044
阅读全文
摘要:博文参考地址: http://blog.csdn.net/loophome/article/details/50767907
阅读全文
摘要:一.Tengine版本采用http_limit_req_module进行限制 具体连接请参考 http://tengine.taobao.org/document_cn/http_limit_req_cn.html 和官方nginx类似,不过支持多个变量,并且支持多个limit_req_zone的设
阅读全文
摘要:参考博文地址: http://blog.51cto.com/arthur376/1953008
阅读全文
摘要:日志切割脚本: [root@lb-nginx logs]# cat /data/scripts/cut_nginxlog.sh #!/bin/sh #Dateformat=date +%Y%m%d Dateformat=(date+Basedir="/aliyun/nginx"Nginxlogdir
阅读全文