nginx template seems to work
This commit is contained in:
parent
804c7ae65d
commit
f34cb60eb8
5 changed files with 101 additions and 1 deletions
|
@ -29,10 +29,14 @@
|
|||
template:
|
||||
src: templates/docker-compose.yml.j2
|
||||
dest: "{{ site_name }}/docker-compose.yml"
|
||||
- name: Generate a nginx config file for our site
|
||||
template:
|
||||
src: templates/nginx-site.conf.j2
|
||||
dest: "{{ site_name }}/{{ site_url }}"
|
||||
# - debug: "Do the MySQL users thingy"
|
||||
#- name: Generate a new nginx server config file
|
||||
#- template:
|
||||
#- src: templates/site.conf.j2
|
||||
#- src: templates/nginx-site.conf.j2
|
||||
#- dest: "/etc/nginx/sites-available/{{ site_url }}"
|
||||
# become: yes
|
||||
# - debug: "Now do `ln -s /etc/nginx/sites-available/{{ site_url }} /etc/nginx/sites-enabled/"
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
version: '3'
|
||||
|
||||
|
||||
# Generated by ansible for site lexperimental.fr
|
||||
# At 172.100.0.2 on 172.100.0.0/24
|
||||
|
||||
services:
|
||||
wp:
|
||||
image: wordpress:apache
|
||||
|
|
44
wordpress/lexperimental/lexperimental.fr
Normal file
44
wordpress/lexperimental/lexperimental.fr
Normal file
|
@ -0,0 +1,44 @@
|
|||
# Generated by ansible for site lexperimental.fr
|
||||
# At 172.100.0.2 on 172.100.0.0/24
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name lexperimental.fr www.lexperimental.fr;
|
||||
|
||||
rewrite ^ https://lexperimental.fr$request_uri permanent;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name lexperimental.fr www.lexperimental.fr;
|
||||
|
||||
access_log /var/log/nginx/lexperimental-access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
# Let's Encrypt
|
||||
include snippets/letsencrypt.conf;
|
||||
|
||||
include snippets/ssl-params.conf;
|
||||
ssl_certificate /etc/letsencrypt/live/lexperimental.fr/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/lexperimental.fr/privkey.pem;
|
||||
|
||||
if ($host = www.lexperimental.fr) {
|
||||
rewrite ^ https://lexperimental.fr$request_uri permanent;
|
||||
}
|
||||
|
||||
# Run by host
|
||||
# root /var/www/lexperimental;
|
||||
# include snippets/wordpress.conf;
|
||||
|
||||
# Run in Docker
|
||||
include snippets/header-params_server.conf;
|
||||
location / {
|
||||
include snippets/header-params_location.conf;
|
||||
|
||||
proxy_pass http://172.100.0.2:80;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,9 @@
|
|||
version: '3'
|
||||
|
||||
|
||||
# Generated by ansible for site {{ site_url }}
|
||||
# At {{ subnet_site_ip }} on {{ subnet_cidr_address }}
|
||||
|
||||
services:
|
||||
wp:
|
||||
image: {{ docker_image }}
|
||||
|
|
44
wordpress/templates/nginx-site.conf.j2
Normal file
44
wordpress/templates/nginx-site.conf.j2
Normal file
|
@ -0,0 +1,44 @@
|
|||
# Generated by ansible for site {{ site_url }}
|
||||
# At {{ subnet_site_ip }} on {{ subnet_cidr_address }}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name {{ site_url }} www.{{ site_url }};
|
||||
|
||||
rewrite ^ https://{{ site_url }}$request_uri permanent;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name {{ site_url }} www.{{ site_url }};
|
||||
|
||||
access_log /var/log/nginx/{{ site_name }}-access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
# Let's Encrypt
|
||||
include snippets/letsencrypt.conf;
|
||||
|
||||
include snippets/ssl-params.conf;
|
||||
ssl_certificate /etc/letsencrypt/live/{{ site_url }}/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/{{ site_url }}/privkey.pem;
|
||||
|
||||
if ($host = www.{{ site_url }}) {
|
||||
rewrite ^ https://{{ site_url }}$request_uri permanent;
|
||||
}
|
||||
|
||||
# Run by host
|
||||
# root /var/www/{{ site_name }};
|
||||
# include snippets/wordpress.conf;
|
||||
|
||||
# Run in Docker
|
||||
include snippets/header-params_server.conf;
|
||||
location / {
|
||||
include snippets/header-params_location.conf;
|
||||
|
||||
proxy_pass http://{{ subnet_site_ip }}:80;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in a new issue