summaryrefslogtreecommitdiffstats
path: root/roles/nginx
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-07-21 14:33:55 +0200
committerAhmed Abdelhalim <[email protected]>2026-07-21 14:33:55 +0200
commit44d7056b2a069b36077b716a32adfb5b978cd898 (patch)
tree50995970f1ecac5ac8300d0216e04cadb95ca87b /roles/nginx
parent5a677725003444d5fc02e4f754392bafaecbde2f (diff)
Fix nginx to use conventional ngix conf.d
Diffstat (limited to 'roles/nginx')
-rw-r--r--roles/nginx/tasks/main.yml9
-rw-r--r--roles/nginx/templates/nginx.conf.j26
2 files changed, 4 insertions, 11 deletions
diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml
index f78cd24b..7cb9b449 100644
--- a/roles/nginx/tasks/main.yml
+++ b/roles/nginx/tasks/main.yml
@@ -26,14 +26,11 @@
- "/etc/nginx/modules-enabled"
- "/var/log/nginx"
-- name: "Ensure nginx vhosts.d directory exists"
+- name: "Remove default nginx server block shipped by package"
become: true
ansible.builtin.file:
- path: "/etc/nginx/vhosts.d"
- state: "directory"
- owner: "root"
- group: "root"
- mode: "0755"
+ path: "/etc/nginx/conf.d/default.conf"
+ state: "absent"
- name: "Check if SSL certificate exists"
become: true
diff --git a/roles/nginx/templates/nginx.conf.j2 b/roles/nginx/templates/nginx.conf.j2
index 1ebbe3df..518a8398 100644
--- a/roles/nginx/templates/nginx.conf.j2
+++ b/roles/nginx/templates/nginx.conf.j2
@@ -43,8 +43,6 @@ http {
listen [::]:80 default_server;
server_name {{ nginx_server_name }};
-
- include /etc/nginx/conf.d/*.conf;
}
{% else %}
# HTTP server - redirect to HTTPS
@@ -73,9 +71,7 @@ http {
add_header X-Content-Type-Options nosniff always;
add_header X-Frame-Options DENY always;
-
- include /etc/nginx/conf.d/*.conf;
}
- include /etc/nginx/vhosts.d/*.conf;
+ include /etc/nginx/conf.d/*.conf;
}