zoukankan      html  css  js  c++  java
  • 【Nginx】 正则在线测试

    起因

    nginx 测试基本都是本地起一个 nginx 服务,然后修改 conf 配置文件进行测试,那么,有没有更方便快捷的方法呢?

    虽然网上有很多正则表达式的网站,但是因为 nginx 和这些网站的正则表达式引擎略有不同,所以很多在线测试的结果是不准确的。

    nginx使用的是 PCRE官方文档介绍

    方法

    nginx 官方提供了一个基于 php 编写的正则测试器 nginx-regex-tester,可以用 docker-compose 直接启动

    测试成功截图;Result: Match found

    测试失败截图:Result:Match not found

    注意问题:

    如果你在 docker-compose up -d 很慢,主要是因为 Dockerfile 的 nginx 镜像使用的国外源

    1. 确认 nginx 是什么系统,在 dockerfile 加入这两句去判断
    RUN cat /etc/issue
    RUN cat /etc/os-release
    
    1. 我刚确认用的是 debian buster 系统,所以直接更换为清华源就好了,
    RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free 
    
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free 
    
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free 
    
    deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" > /etc/apt/sources.list
    

    如图所示;

    https://www.nginx.com/blog/regular-expression-tester-nginx/

  • 相关阅读:
    Asp.net调用百度搜索引擎
    iOS 之 alcatraz (插件管理器)
    @dynamic、@synthesize
    iOS 准备
    iOS 沙盒
    iOS 引导页
    iOS 开发之登陆
    iOS 程序开发
    Java 验证用户名、密码
    数据库操作
  • 原文地址:https://www.cnblogs.com/UncleZhao/p/14236724.html
Copyright © 2011-2022 走看看