Created stripped down default nginx virtual host configuration
This commit is contained in:
parent
8a31ccb6ac
commit
e3cdb84192
@ -5,3 +5,12 @@ nginx_package_state: present
|
||||
nginx_service_name: nginx
|
||||
nginx_service_state: started
|
||||
nginx_service_enabled: yes
|
||||
|
||||
nginx_root: /var/www/html
|
||||
nginx_index:
|
||||
- index.html
|
||||
- index.htm
|
||||
#- index.nginx-debian.html;
|
||||
|
||||
nginx_acme_challenge_enabled: yes
|
||||
nginx_acme_challenge_path: /var/www/.acme-challenge
|
||||
|
@ -12,6 +12,15 @@
|
||||
name: "{{ nginx_package_name }}"
|
||||
state: "{{ nginx_package_state }}"
|
||||
|
||||
- name: configure default virtual host
|
||||
template:
|
||||
src: default.j2
|
||||
dest: /etc/nginx/sites-available/default
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: reload nginx
|
||||
|
||||
- name: manage service
|
||||
service:
|
||||
name: "{{ nginx_service_name }}"
|
||||
|
21
roles/nginx/templates/default.j2
Normal file
21
roles/nginx/templates/default.j2
Normal file
@ -0,0 +1,21 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
root {{ nginx_root }};
|
||||
|
||||
index {{ nginx_index | join(' ') }};
|
||||
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
{% if nginx_acme_challenge_enabled %}
|
||||
location /.well-known/acme-challenge/ {
|
||||
alias {{ nginx_acme_challenge_path }};
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
{% endif %}
|
||||
}
|
Loading…
Reference in New Issue
Block a user