INNER CODE UNIT · Python

get_nginx_ssl_config

piku/piku · piku.py:337

def get_nginx_ssl_config():
    """Detect nginx version and return (ssl_listen, http2_directive) tuple.

    nginx >=1.25.1 uses a separate 'http2 on;' directive.
    Older versions append 'http2' to the listen line."""
    nginx = command_output("nginx -V")
    nginx_ssl = "443 ssl"
    nginx_http2 = ""
    if "--with-http_v2_module" in nginx:
        nginx_version = ""
        for part in nginx.split():
            if part.startswith("nginx/"):
                nginx_version = part.split("/")[1]
                break
        try:
            ver_tuple = tuple(int(x) for x in nginx_version.split("."))
        except (ValueError, AttributeError):
            ver_tuple = (0, 0, 0)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…