diff --git a/roles/debian/nginx/tasks/main.yml b/roles/debian/nginx/tasks/main.yml index afe537000..72fab6e10 100644 --- a/roles/debian/nginx/tasks/main.yml +++ b/roles/debian/nginx/tasks/main.yml @@ -66,6 +66,10 @@ state: directory mode: "0755" +- name: Set nginx location behavior, fallback to default if no custom behavior is provided + set_fact: + nginx_location_behavior: "{{ nginx.custom_nginx_location_behavior | default(['try_files @rewrite /index.php?$query_string;']) }}" + - name: Copy project type-specific configuration in place. ansible.builtin.template: src: "{{ item }}.j2" @@ -150,10 +154,6 @@ - nginx.overrides is defined - nginx.overrides | length > 0 -- name: Set nginx location behavior, fallback to default if no custom behavior is provided - set_fact: - nginx_location_behavior: "{{ nginx.custom_nginx_location_behavior | default(['try_files @rewrite /index.php?$query_string;']) }}" - - name: Test NGINX configuration. ansible.builtin.command: nginx -t register: _nginx_test_result diff --git a/roles/debian/nginx/templates/drupal_common.j2 b/roles/debian/nginx/templates/drupal_common.j2 index eb2eca4b8..c8b64a644 100644 --- a/roles/debian/nginx/templates/drupal_common.j2 +++ b/roles/debian/nginx/templates/drupal_common.j2 @@ -22,7 +22,7 @@ location / { # @todo # limit_req zone=bots burst=5 nodelay; {% endif %} - {{ nginx.nginx_location_behavior | join("\n ") }} + {{ nginx_location_behavior | join("\n ") }} } ############ Blacklist block.