nginx,

Modify Nginx load order

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

In Nginx, the configuration files are loaded in a specific order by default. However, you can modify the load order to customize the behavior of the server.

Prerequisites

  • Nginx

Solution

To create a custom load order, open nginx.conf and order config files load by including them one after each other. In the http block you can have something like this:

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/custom-configs/*.conf;

As an alternative way, you could always prefix files. For instance, you can have: 00-devcoops.conf, 01-stats.devcoops.com.conf, 02-wildcard.conf, etc …

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.