- name: Générer un certififat avec certbot # noqa : command-instead-of-module
become: true
- ansible.builtin.command: 'certbot certonly -n --nginx -d {{ SITE }}.{{ DOMAIN }}.{{ TLD }}'
+ ansible.builtin.command: 'certbot certonly -n --nginx -d {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }}'
register: certbot_log
ignore_errors: true
changed_when: false
server {
listen 80;
- server_name
- {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }};
+ server_name {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }};
disable_symlinks if_not_owner;
access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/access.log main buffer=32k;
error_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/error.log warn;
-server_name {{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }};
+server_name {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }};
root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/www;
location / {
access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/access.log main buffer=32k;
error_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/error.log warn;
{% if ssl_ready is defined and ssl_ready %}
- return 301 https://{{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}$request_uri;
+ return 301 https://$server_name$request_uri;
}
server {
listen 443;
-server_name
- {{ DOMAIN }}.{{ TLD }}
- {{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }};
-rewrite ^/(.*) http://{{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}/$1 permanent;
+server_name {{ DOMAIN }}.{{ TLD }} {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }};
+{# semble ne pas être nécessaire rewrite ^/(.*) http://{{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }}/$1 permanent; #}
root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/;
index index.html;
server {
listen 80;
include /etc/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/common.conf;
- server_name {{ DOMAIN }}.{{ TLD }};
access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/access.log main buffer=32k;
error_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/error.log warn;
{% if ssl_ready is defined and ssl_ready %}
- return 301 https://{{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}$request_uri;
+ return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;