Is there a formatter/beautifier for NGINX config files?

Peter Willemsen picture Peter Willemsen · Dec 8, 2013 · Viewed 15.8k times · Source

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!

Answer

lyoko picture lyoko · Aug 26, 2016

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.