-
-
Save anthonyscolaro/18f56094637d1e6e441ecf0781c7e9b0 to your computer and use it in GitHub Desktop.
reverse proxy setup - need to call to the ip in pillar list for each domain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local: | |
Data failed to compile: | |
---------- | |
Rendering SLS 'prod:nginx.ng.vhosts' failed: Jinja variable 'None' has no attribute 'items' | |
/var/cache/salt/minion/files/prod/nginx/ng/vhosts_config.sls(82): | |
--- | |
[...] | |
{{ sls_block(nginx.vhosts.dir_opts) }} | |
- name: {{ nginx.lookup.vhost_available }} | |
{%- endif %} | |
# Manage the actual vhost files | |
{% for vhost, settings in nginx.vhosts.managed.items() %} <====================== | |
{% endfor %} | |
# Managed enabled/disabled state for vhosts | |
{% for vhost, settings in nginx.vhosts.managed.items() %} | |
{% if settings.config != None %} | |
[...] | |
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
staging_servers: | |
domains: | |
staging.siteurl.com: | |
ip: 192.168.0.100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include: | |
- webserver.reverse_proxy.domain_data | |
nginx: | |
ng: | |
package: | |
opts: | |
fromrepo: {{ salt['grains.get']('oscodename') }} | |
lookup: | |
vhost_enabled: /var/www/nginx/vhosts | |
package: nginx-common | |
server: | |
config: | |
user: www-data | |
worker_processes: auto | |
pid: /run/nginx.pid | |
events: | |
worker_connections: 1024 | |
multi_accept: 'on' | |
use: epoll | |
http: | |
sendfile: 'on' | |
tcp_nopush: 'on' | |
keepalive_timeout: 65 | |
types_hash_max_size: 2048 | |
include: | |
- /etc/nginx/mime.types | |
- /etc/nginx/conf.d/*.conf | |
- /var/www/nginx/*.conf | |
- /etc/nginx/sites-enabled/* | |
default_type: applications/octet-stream | |
access_log: /var/log/nginx/access.log | |
error_log: /var/log/nginx/error.log | |
gzip: 'on' | |
vhosts: | |
dir_opts: | |
user: www-data | |
group: www-data | |
dir_mode: 755 | |
managed_opts: | |
user: www-data | |
group: www-data | |
mode: 644 | |
symlink_opts: | |
user: www-data | |
group: www-data | |
mode: 644 | |
managed: | |
{%- set staging_server_data = pillar.get('staging_servers', {} ) %} | |
{%- set default_params = dict(ip=empty) %} | |
{%- for domain, domain_data in staging_server_data.get('domains', {}).items() %} | |
{%- if domain_data is not mapping %} | |
{%- set ip = default_params['ip'] %} | |
{%- else %} | |
{%- set ip = domain_data.get('ip', default_params['ip'] ) %} | |
{%- endif %} | |
rev-{{ domain }}.conf: | |
enabled: True | |
config: | |
- server: | |
- listen: | |
- 80 | |
- listen: | |
- '[::]:80' | |
- server_name: | |
- {{ domain }} | |
- location /: | |
- proxy_pass: | |
- http://{{ ip }}:80/ | |
- proxy_redirect: | |
- off | |
- proxy_set_header: | |
- Host $http_host | |
- proxy_set_header: | |
- X-Real-IP $remote_addr | |
- proxy_set_header: | |
- X-Forwarded-For $proxy_add_x_forwarded_for | |
- proxy_max_temp_file_size: | |
- 0 | |
- client_max_body_size: | |
- 10m | |
- client_body_buffer_size: | |
- 128k | |
- proxy_connect_timeout: | |
- 90 | |
- proxy_send_timeout: | |
- 90 | |
- proxy_read_timeout: | |
- 90 | |
- proxy_buffer_size: | |
- 4k | |
- proxy_buffers: | |
- 4 32k | |
- proxy_busy_buffers_size: | |
- 64k | |
- proxy_temp_file_write_size: | |
- 64k | |
{%- endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment