Skip to content

Commit

Permalink
Fix: nginx: [emerg] "http2" directive is duplicate in /data/nginx/htt…
Browse files Browse the repository at this point in the history
…p_default.conf
  • Loading branch information
rexzhang committed Oct 8, 2024
1 parent 49a0b97 commit dc971d0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions plush/nginx_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
logger = getLogger(__name__)


black_template_default_listen = """
block_template_default_listen = """
listen $port default_server;
listen [::]:$port default_server;"""

black_template_default_listen_ssl = """
block_template_default_listen_ssl = """
listen $port ssl default_server;
listen [::]:$port ssl default_server;
listen [::]:$port ssl default_server;"""

block_template_default_listen_ssl = """
http2 on;"""

block_template_ssl = """
Expand Down Expand Up @@ -583,14 +585,16 @@ def generate_default_conf_content(self) -> str:
default_listen_content = ""
for port in self.http_default_listen:
default_listen_content += Template(
black_template_default_listen
block_template_default_listen
).substitute({"port": port})

default_listen_ssl_content = ""
for port in self.http_default_listen_ssl:
default_listen_ssl_content += Template(
black_template_default_listen_ssl
block_template_default_listen_ssl
).substitute({"port": port})
if default_listen_ssl_content: # TODO: global value/constant
default_listen_ssl_content += block_template_default_listen_ssl

return Template(http_default_conf_template).substitute(
{
Expand Down

0 comments on commit dc971d0

Please sign in to comment.