Skip to content

Commit 149af43

Browse files
authored
Updating-haymarket-drupal-common (#2312)
* Updating-haymarket-drupal-common * Fixing-j2-spaces-drupal-common
1 parent b64ab8b commit 149af43

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

roles/debian/nginx/defaults/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,17 @@ nginx:
127127
php_fastcgi_backend: "127.0.0.1:90{{ php.version[-1] | replace('.', '') }}" # for unix socket use "unix:/var/run/php{{ php.version[-1] | replace('.','') }}-fpm.sock"
128128
ratelimitingcrawlers: false
129129
client_max_body_size: "700M"
130+
# Default location behavior for nginx
131+
# If no custom location behavior is defined, this will be used:
132+
# nginx_location_behavior: ['try_files @rewrite /index.php?$query_string;']
133+
134+
# Uncomment and customize the following lines if you want to use custom location behavior:
135+
# custom_nginx_location_behavior:
136+
# - 'index index.php index.html;'
137+
# - 'expires max;'
138+
# - 'set $boost_cache_path "/cache/normal/$host";'
139+
# - 'set $boost_cache_file "${boost_cache_path}${uri}_.html";'
140+
# - 'try_files $boost_cache_file $uri $uri/ @drupal;'
130141
fastcgi_read_timeout: 60
131142
recreate_vhosts: true # handle vhosts with ansible, if 'true' then clean up 'sites-enabled' dir and run domain.yml.
132143
vhost_backup_location: "/home/{{ _ce_provision_username }}" # see _init for _ce_provision_username

roles/debian/nginx/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@
150150
- nginx.overrides is defined
151151
- nginx.overrides | length > 0
152152

153+
- name: Set nginx location behavior, fallback to default if no custom behavior is provided
154+
set_fact:
155+
nginx_location_behavior: "{{ nginx.custom_nginx_location_behavior | default(['try_files @rewrite /index.php?$query_string;']) }}"
156+
153157
- name: Test NGINX configuration.
154158
ansible.builtin.command: nginx -t
155159
register: _nginx_test_result

roles/debian/nginx/templates/drupal_common.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ location @phpprocess {
1919
# so they get processed through the app level (and 404).
2020
location / {
2121
{% if nginx.ratelimitingcrawlers %}
22-
# @todo
23-
# limit_req zone=bots burst=5 nodelay;
22+
# @todo
23+
# limit_req zone=bots burst=5 nodelay;
2424
{% endif %}
25-
try_files @rewrite /index.php?$query_string;
25+
{{ nginx.nginx_location_behavior | join("\n ") }}
2626
}
2727

2828
############ Blacklist block.

0 commit comments

Comments
 (0)