Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx - Is there a CLI tool for editing the configuration file?

For example, I'd like to set a new or remove a virtual host in the nginx.conf configuration file without editing it directly but using a command-line tool, like:

nginx-cli add-server [options]
nginx-cli remove-server [options]
like image 319
Mark Avatar asked Oct 30 '11 23:10

Mark


People also ask

How do I access nginx config file?

Every NGINX configuration file will be found in the /etc/nginx/ directory, with the main configuration file located in /etc/nginx/nginx. conf .

Which command is used to test the configuration changes of nginx server?

Through a simple command you can verify the status of the Nginx configuration file: $ sudo systemctl config nginx The output will show if the configuration file is correct or, if it is not, it will show the file and the line where the problem is.

Where is nginx configure command?

By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .


1 Answers

I don't know if either of these will exactly fill your need, but they both offer some tools for nginx

  • Nginx VHost Tools includes a tool for generating and saving a nginx config file, which might help.
  • Nginx Tools has a tool for managing sites as well as minifying config files. Probably not what you're looking for, but you may the source helpful.
like image 188
brc Avatar answered Sep 28 '22 00:09

brc