In the previous post Multiple ways to test a Nginx location match I wrote about how to test the location match but here’s the thing. You need to know the order first before testing anything, right?!
The processing order of priority when dealing with Nginx server blocks is the following one:
- The exact names being processed first.
- Longest wildcard names starting with an asterisk
- Longest wildcard names ending with an asterisk
- First matching regular expression (in order of appearance in a config file).
- The default server block.
Official Nginx docs: Server names.
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.