Created stripped down default nginx virtual host configuration

This commit is contained in:
Ryan Cavicchioni 2019-11-24 16:31:06 -06:00
parent 8a31ccb6ac
commit e3cdb84192
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
3 changed files with 39 additions and 0 deletions

View File

@ -5,3 +5,12 @@ nginx_package_state: present
nginx_service_name: nginx nginx_service_name: nginx
nginx_service_state: started nginx_service_state: started
nginx_service_enabled: yes 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

View File

@ -12,6 +12,15 @@
name: "{{ nginx_package_name }}" name: "{{ nginx_package_name }}"
state: "{{ nginx_package_state }}" 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 - name: manage service
service: service:
name: "{{ nginx_service_name }}" name: "{{ nginx_service_name }}"

View 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 %}
}