Commit cf7053c1 authored by Joshua Tauberer's avatar Joshua Tauberer

set nginx server_names_hash_bucket_size to 64, fixes #93

parent 430b2dec
......@@ -13,6 +13,11 @@ rm -f /etc/nginx/sites-enabled/default
# SSL settings from @konklone
cp conf/nginx-ssl.conf /etc/nginx/nginx-ssl.conf
# Fix some nginx defaults.
# The server_names_hash_bucket_size seems to prevent long domain names?
tools/editconf.py /etc/nginx/nginx.conf -s \
server_names_hash_bucket_size="64;"
# Other nginx settings will be configured by the management service
# since it depends on what domains we're serving, which we don't know
# until mail accounts have been created.
......
......@@ -68,24 +68,29 @@ while len(input_lines) > 0:
for i in range(len(settings)):
# Check that this line contain this setting from the command-line arguments.
name, val = settings[i].split("=", 1)
m = re.match("\s*" + re.escape(name) + delimiter_re + "(.*?)\s*$", line, re.S)
m = re.match("(\s*)(#\s*)?" + re.escape(name) + delimiter_re + "(.*?)\s*$", line, re.S)
if not m: continue
indent, is_comment, existing_val = m.groups()
# If this is already the setting, do nothing.
if m.group(1) == val:
if is_comment is None and existing_val == val:
buf += line
found.add(i)
break
# comment-out the existing line (also comment any folded lines)
if is_comment is None:
buf += "#" + line.rstrip().replace("\n", "\n#") + "\n"
else:
# the line is already commented, pass it through
buf += line
# if this option oddly appears more than once, don't add the setting again
if i in found:
break
# add the new setting
buf += name + delimiter + val + "\n"
buf += indent + name + delimiter + val + "\n"
# note that we've applied this option
found.add(i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment