uncopenweb / uow

JavaScript components and catalog application for UNC Open Web servers
3 stars 0 forks source link

Adding code to domain specific nginx.conf files #21

Open gbishop opened 14 years ago

gbishop commented 14 years ago

I need a way to add code to the generated nginx.conf files. I need to add funny bits for various reasons. Then I forget that I edited the file that clearly says I shouldn't and it gets blown away on the next update.

Maybe an include? Or some kind of block in the uow conf files for arbitrary text to insert?

parente commented 14 years ago

I needed this too at one point. An nginx_include section would do the trick. Would be nice to inline it in the existing conf files but not sure about multiline. Worst case, conf files refers to some external file that gets read and included.

Slightly off topic, but still useful, supporting options in the top-level nginx.conf file would also be nice. There's a bunch of stuff you have enabled for Linux that I can't / don't want to enable on my Mac for catalog development.

gbishop commented 14 years ago

Yes. So perhaps two sections in the conf file. One global and one per server.

gbishop commented 14 years ago

A quick check reveals two nice things:

First, ConfigParser accepts multiline inputs with python like syntax using : instead of = so long: this value continues in the next line

That last line above is indented in case the spaces don't make it.

And 2, the nginx config lines that are incompatible all happen to be allowable in the any of http, server, or location.

So I'll try to add a new field to the [nginx] section of the conf file for random lines you'd like to insert. Then I'll take the offensive lines out of the nginx.conf and put them in the site specific file. This should be much cleaner and allow inserting random stuff.

parente commented 14 years ago

Does supervisord use ConfigParser?

gbishop commented 14 years ago

Ah, I forgot that supervisord reads these things too. Just tested and it does not choke on the file with the long line, so I think we're fine.