nginx,

Multiple ways to test a Nginx location match

May 05, 2023 · 1 min read · Post a comment

Testing a Nginx location and order of server blocks is a challenge when dealing with various, complicated config files. So, here are few ways you could try to validate the location match.

Prerequisites

  • Nginx

Solution

Solution #1. The Nginx location match tester: https://nginx.viraptor.info

It might not work, or it might be bugged when dealing with wildcard server blocks.

Solution #2. Spin up a Nginx Docker container, map all required config files into the container found under /etc/nginx/conf.d/, update your local hosts file and try testing with curl.

Solution #3. The Nginx official Regular Expression Tester.

Solution #4. ChatGPT?!

Conclusion

In case you face any issues, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.