nginx_site: Allow to run site in custom port

This commit is contained in:
Timo Makinen 2025-07-16 20:50:48 +00:00
parent 72736c8b13
commit fd69bcdec0
2 changed files with 8 additions and 3 deletions

View file

@ -10,7 +10,12 @@
- name: "Create site config for {{ nginx_site_name }}"
ansible.builtin.template:
dest: /etc/nginx/conf.d/{{ nginx_site_name }}.conf
dest: >-
/etc/nginx/conf.d/{{ nginx_site_name }}{%
if nginx_site_port is defined
%}:{{nginx_site_port }}{%
endif
%}.conf
src: site.conf.j2
mode: "0644"
owner: root

View file

@ -14,8 +14,8 @@ upstream {{ nginx_site_name }} {
}
{% endif %}
server {
listen 443 ssl;
listen [::]:443 ssl;
listen {{ nginx_site_port | default('443') }} ssl;
listen [::]:{{ nginx_site_port | default('443') }} ssl;
http2 on;
http3 off;