Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use http2 and http3 nginx directives #1529

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roles/wordpress-setup/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ nginx_sites_confs:
- src: ssl.no-default.conf.j2
enabled: false

http2_enabled: true
http3_enabled: false
strarsis marked this conversation as resolved.
Show resolved Hide resolved

# HSTS defaults
nginx_hsts_max_age: 31536000
nginx_hsts_include_subdomains: false
Expand Down
12 changes: 8 additions & 4 deletions roles/wordpress-setup/templates/wordpress-site.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

server {
{% block server_id -%}
listen {{ ssl_enabled | ternary('[::]:443 ssl http2', '[::]:80') }};
listen {{ ssl_enabled | ternary('443 ssl http2', '80') }};
listen {{ ssl_enabled | ternary('[::]:443 ssl', '[::]:80') }};
listen {{ ssl_enabled | ternary('443 ssl', '80') }};
http2 {{ http2_enabled | default(false) | ternary('on', 'off') }};
http3 {{ http3_enabled | default(false) | ternary('on', 'off') }};
server_name {{ site_hosts_canonical | union(multisite_subdomains_wildcards) | join(' ') }};
{% endblock %}

Expand Down Expand Up @@ -290,11 +292,13 @@ server {
{% for host in item.value.site_hosts if host.redirects | default([]) %}
server {
{% if ssl_enabled -%}
listen [::]:443 ssl http2;
listen 443 ssl http2;
listen [::]:443 ssl;
listen 443 ssl;
{% endif -%}
listen [::]:80;
listen 80;
http2 {{ http2_enabled | default(false) | ternary('on', 'off') }};
http3 {{ http3_enabled | default(false) | ternary('on', 'off') }};
server_name {{ host.redirects | join(' ') }};

{{ self.https() -}}
Expand Down
Loading