weareinteractive / ansible-nginx Goto Github PK
View Code? Open in Web Editor NEWAnsible role which installs and configures nginx
License: MIT License
Ansible role which installs and configures nginx
License: MIT License
How does template lookup find the site config template specified as item.template
? Where do I put it? Putting in the playbook file's directory doesn't work neither does templates
subdir there.
AFAIU, the approach suggested here suggests creating a local role w/ the same name that contains only the template file, but this seems to override the tasks as well resulting in an empty local role.
Hi,
I'm using this role with the following configuration and template to give myself a reverse proxy configuration.
I'm wondering if you are interested in having in built support for reverse proxies like this and if yes which bits you'd like to see made configurable.
Things I'm guessing you'd like to see configurable are listed below but do you have any others?
If you're interested I'll put together a PR for a more detailed review.
nginx_sites:
- id: credentials
name: "example.com"
ip: x.x.x.x
state: present
add_webroot: no
aliases:
- "alias.example.com"
template: templates-shared/nginx-with-https-upgrade.tmpl
webroot: "/srv/x/webroot"
# Where the .well-known folder sits in
wellknown: "/srv/x/letsencrypt"
redirects:
- "{{ another.example.com }}"
- "{{ something.example.com }}.au"
ssl:
cert_path: /etc/letsencrypt/live/{{ x }}
cert_name: fullchain.pem
key_name: privkey.pem
rules: []
append: ''
cat reverse-proxy.j2
# {{ ansible_managed }}
# HTTPS terminating proxy sitting in front of webapp.
# TODO: Check: Some of this file can probably be removed with no loss in functionality.
# default_server on listen is required to work around bug https://github.com/certbot/certbot/issues/5817#issuecomment-391051737
server {
server_name {{ item.name }}{% for value in item.aliases|default([]) %} {{ value }}{% endfor %};
return 301 https://$host$request_uri;
listen 80 ;
return 404;
}
server {
server_name {{ item.name }}{% for value in item.aliases|default([]) %} {{ value }}{% endfor %};
charset utf-8;
keepalive_timeout 65;
client_max_body_size 128M;
gzip_types text/css application/javascript text/javascript text/plain text/xml application/xml;
gzip_vary on;
root {{ item.webroot }};
# Letsencrypt
location /.well-known {
alias {{ item.wellknown }}/.well-known;
}
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
listen 443 ssl;
ssl_certificate {{ item.ssl.cert_path |default(openssl_certs_path) }}/{{ item.ssl.cert_name|default('server.crt') }};
ssl_certificate_key {{ item.ssl.cert_path |default(openssl_keys_path) }}/{{ item.ssl.key_name|default('server.key') }};
}
I'm getting this error on Ubuntu 14.04:
2015/05/25 13:08:32 [emerg] 18720#0: "daemon" directive is duplicate in /etc/nginx/nginx.conf:17
Commenting out line 17:
Seems to resolve the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.