I can configure Nginx Reverse proxy with nginx server blocks by creating and editing configuration files. But its there a way to automate this process and configure reverse proxy entries and Lets encrypt certificates with API.
Asked
Active
Viewed 525 times
1 Answers
2
You can use a configuration management system like Ansible to create nginx and overall system configuration using templates and modules.
nginx by itself does not have any runtime API to change configuration.

Tero Kilkanen
- 36,796
- 3
- 41
- 63
-
also, you can develop your own api to add or change nginx config files and reload it afterwads – surfingonthenet Apr 27 '21 at 19:34
-
1I wouldn't recommend building an own API for that purpose. That requires very careful planning and implementation in order to make it secure. Furthermore, it adds to your code maintenance workload, which is higher than usually estimated. One should use established tools whenever possible. – Tero Kilkanen Apr 27 '21 at 20:14
-
Tero, I respect your opinion, but I do believe building automated routines suite pretty good for some scenarios. I have already done things like adding a customer and automatically configure DNS hosts and web server, and it works like a charm, for me – surfingonthenet Apr 27 '21 at 23:30
-
I really hope your implementation does proper validation of the configuration change strings and access control has been properly implemented. Otherwise your web server works well for malicious actors too... – Tero Kilkanen Apr 28 '21 at 06:30
-
sure, that's one of the reason I like this approach, the possibility to improve input validation, automate, and make thinks easier to the team – surfingonthenet Apr 28 '21 at 15:50