I have got this messy config for example:
server {
listen 80 default;
server_name localhost;
location / {
proxy_method $foo;
proxy_pass http://foobar:8080;
}
}
and I would like to make it look like:
server
{
listen 80 default;
server_name localhost;
location /
{
proxy_method $foo;
proxy_pass http://foobar:8080;
}
}
How can I format Nginx configurations in a better way?
There are a few formatters out there, such as:
installing it from npm(nodejs package manager):
npm install -G nginxbeautifier
installing it from arch aur (arch user repository):
pacaur -S nginxbeautifier
cloning from by github repository(git and github):
git clone https://github.com/vasilevich/nginxbeautifier.git
instructions on how to use the program locally are available once you execute nginxbeautifier -h or nginxbeautifier --help and also on the github page itself.
Full disclosure I am the developer and the maintainer of "nginxbeautifier.com"
and the relevant github page
please report any issuses there,
some of the code in nginxbeautifier was
acctualy inspired by the first option mentioned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With