Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a formatter/beautifier for NGINX config files? [closed]

I know this may sound a little stupid, but one of my NGINX config files is a piece of crap when it comes to formatting. It works and all but that's about it.

I tried to find some kind of beautifier or formatter, like http://jsbeautifier.org/ but then for nginx config files instead of javascript, but no luck so far.

I hope anyone would have a suggestion. There are no requirements, as long as it can format quickly / lazily made NGINX config files!

Thanks!

like image 319
Peter Willemsen Avatar asked Dec 08 '13 20:12

Peter Willemsen


People also ask

How do I know if my nginx config is correct?

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.

Does spacing matter in Nginx config?

For most of your nginx. conf this won't hurt anything. If you have quoted strings with multiple spaces those will get changed too by the command above.

Where is the nginx config stored?

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


1 Answers

I found a few projects which might suit your needs:

  1. Nginx Formatter (python) by 1connect
    you can get it here
  2. Nginx beautifier (js/nodejs) by vasilevich
    nginxbeautifier.com which lets you format configs quickly in a web browser. you can get a command line tool also on the same site to run it locally.
like image 81
lyoko Avatar answered Sep 26 '22 03:09

lyoko