2014-05-16 00:06:48 +02:00
|
|
|
{% macro sls_block(dict) %}
|
|
|
|
{% for key, value in dict.items() %}
|
|
|
|
- {{ key }}: {{ value|json() }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% set nginx = salt['pillar.get']('nginx:ng', {
|
|
|
|
'lookup': salt['grains.filter_by']({
|
|
|
|
'Debian': {
|
|
|
|
'package': 'nginx',
|
|
|
|
'service': 'nginx',
|
|
|
|
'webuser': 'www-data',
|
|
|
|
'conf_file': '/etc/nginx/nginx.conf',
|
|
|
|
'vhost_available': '/etc/nginx/sites-available',
|
|
|
|
'vhost_enabled': '/etc/nginx/sites-enabled',
|
|
|
|
'vhost_use_symlink': True,
|
|
|
|
},
|
|
|
|
'RedHat': {
|
|
|
|
'package': 'nginx',
|
|
|
|
'service': 'nginx',
|
2014-11-08 00:29:50 +01:00
|
|
|
'webuser': 'nginx',
|
2014-05-16 00:06:48 +02:00
|
|
|
'conf_file': '/etc/nginx/nginx.conf',
|
|
|
|
'vhost_available': '/etc/nginx/conf.d',
|
|
|
|
'vhost_enabled': '/etc/nginx/conf.d',
|
|
|
|
'vhost_use_symlink': False,
|
|
|
|
},
|
|
|
|
}, default='Debian' ),
|
2014-08-12 04:01:38 +02:00
|
|
|
'install_from_source': False,
|
|
|
|
'install_from_ppa': False,
|
2015-02-10 20:59:49 +01:00
|
|
|
'ppa_version': 'stable',
|
2014-05-16 00:06:48 +02:00
|
|
|
'package': {
|
|
|
|
'opts': {},
|
|
|
|
},
|
|
|
|
'service': {
|
|
|
|
'enable': True,
|
|
|
|
'opts': {},
|
|
|
|
},
|
|
|
|
'server': {
|
|
|
|
'opts': {},
|
|
|
|
'config': {
|
|
|
|
'worker_processes': 4,
|
|
|
|
'pid': '/run/nginx.pid',
|
|
|
|
'events': {
|
|
|
|
'worker_connections': 768,
|
|
|
|
},
|
|
|
|
'http': {
|
|
|
|
'sendfile': 'on',
|
|
|
|
'tcp_nopush': 'on',
|
|
|
|
'tcp_nodelay': 'on',
|
|
|
|
'keepalive_timeout': '65',
|
|
|
|
'types_hash_max_size': '2048',
|
|
|
|
'default_type': 'application/octet-stream',
|
|
|
|
'access_log': '/var/log/nginx/access.log',
|
|
|
|
'error_log': '/var/log/nginx/error.log',
|
|
|
|
'gzip': 'off',
|
|
|
|
'gzip_disable': '"msie6"',
|
|
|
|
'include': [
|
|
|
|
'/etc/nginx/mime.types',
|
|
|
|
'/etc/nginx/conf.d/*.conf',
|
|
|
|
'/etc/nginx/sites-enabled/*',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'vhosts': {
|
|
|
|
'disabled_postfix': '.disabled',
|
|
|
|
'symlink_opts': {},
|
|
|
|
'rename_opts': {},
|
|
|
|
'managed_opts': {},
|
|
|
|
'dir_opts': {
|
|
|
|
'makedirs': True,
|
|
|
|
},
|
2014-05-19 19:04:43 +02:00
|
|
|
'managed': {},
|
2014-05-16 00:06:48 +02:00
|
|
|
},
|
2014-07-03 22:40:15 +02:00
|
|
|
}, merge=True) %}
|
2014-05-16 00:06:48 +02:00
|
|
|
|
|
|
|
{% if 'user' not in nginx.server.config %}
|
|
|
|
{% do nginx.server.config.update({
|
|
|
|
'user': nginx.lookup.webuser,
|
|
|
|
})%}
|
|
|
|
{% endif %}
|