Does nginx support comment blocks in configuration?

I have here an nginx config. I need to comment out blocks in it:

...things I want...
...things I don't want...
...things I want...

The things are 30-50 lines long, and I won’t backup and delete them. I also don’t want write #s to the beginning of 30-50 code lines, and I also don’t want to script/configure my text editor to do this. I think it is a quite trivial feature.

I tried

...things I want...
...things I don't want...
...things I want...

But it doesn’t work. Is it really an unsupported feature in the nginx?

Asked By: peterh


Nginx configuration files do not support comment blocks; they only accept # at the beginning of a line for a comment. You can also have a valid statement followed by a # and then a comment on the same line. (Source.)

If you have between 30 and 50 lines to ditch out I’d suggest, to avoid confusion, to remove the block entirely (after making a copy of the file, unless you’re using a version control system such as Git).

Answered By: dr_
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.