commit
1b616bf3fc
12
README.rst
12
README.rst
@ -49,10 +49,10 @@ Installs nginx via the source files.
|
||||
``nginx.users``
|
||||
---------------
|
||||
|
||||
Installs apache utils, and configures nginx users specified in the pillar.
|
||||
This requires `basicauth <https://github.com/saltstack/salt-contrib/blob/master/modules/basicauth.py>`_
|
||||
from `salt-contrib <https://github.com/saltstack/salt-contrib/>`_ (either add it to your salt or ship
|
||||
this single file in your `_modules` directory see `Dynamic Module Distribution
|
||||
Installs apache utils, and configures nginx users specified in the pillar.
|
||||
This requires `basicauth <https://github.com/saltstack/salt-contrib/blob/master/modules/basicauth.py>`_
|
||||
from `salt-contrib <https://github.com/saltstack/salt-contrib/>`_ (either add it to your salt or ship
|
||||
this single file in your `_modules` directory see `Dynamic Module Distribution
|
||||
<https://docs.saltstack.com/en/latest/ref/file_server/dynamic-modules.html>`_
|
||||
|
||||
Next-generation, alternate approach
|
||||
@ -108,7 +108,7 @@ Manages nginx virtual hosts files and binds them to service calls.
|
||||
----------------------
|
||||
|
||||
Installs and configures Phusion Passenger module for nginx. You need to enable
|
||||
the upstream phusion passenger repository with `install_from_phusionpassenger: true`.
|
||||
the upstream phusion passenger repository with `install_from_phusionpassenger: true`.
|
||||
Nginx will also be installed from that repository, as it needs to be modified to
|
||||
allow the passenger module to work.
|
||||
allow the passenger module to work.
|
||||
|
||||
|
@ -14,8 +14,8 @@ nginx_log_dir:
|
||||
|
||||
{% if 'source_path' in nginx.server.config %}
|
||||
{% set source_path = nginx.server.config.source_path %}
|
||||
{% else %}
|
||||
{% set source_path = 'salt://nginx/ng/files/nginx.conf' %}
|
||||
{% else %}
|
||||
{% set source_path = 'salt://nginx/ng/files/nginx.conf' %}
|
||||
{% endif %}
|
||||
nginx_config:
|
||||
file.managed:
|
||||
|
@ -80,6 +80,17 @@
|
||||
'server_enabled': '/etc/nginx/sites-enabled',
|
||||
'server_use_symlink': True,
|
||||
},
|
||||
'FreeBSD': {
|
||||
'package': 'nginx',
|
||||
'passenger_package': 'passenger',
|
||||
'service': 'nginx',
|
||||
'webuser': 'www',
|
||||
'conf_file': '/usr/local/etc/nginx/nginx.conf',
|
||||
'server_available': '/usr/local/etc/nginx/sites-available',
|
||||
'server_enabled': '/usr/local/etc/nginx/sites-enabled',
|
||||
'server_use_symlink': True,
|
||||
'pid_file': '/var/run/nginx.pid',
|
||||
},
|
||||
}, default='Debian' ),
|
||||
'install_from_source': False,
|
||||
'install_from_ppa': False,
|
||||
@ -117,9 +128,9 @@
|
||||
'gzip': 'off',
|
||||
'gzip_disable': '"msie6"',
|
||||
'include': [
|
||||
'/etc/nginx/mime.types',
|
||||
'/etc/nginx/conf.d/*.conf',
|
||||
'/etc/nginx/sites-enabled/*',
|
||||
'mime.types',
|
||||
'conf.d/*.conf',
|
||||
'sites-enabled/*',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -17,8 +17,8 @@ nginx_systemd_service_file:
|
||||
file.managed:
|
||||
- name: /lib/systemd/system/nginx.service
|
||||
- source: salt://nginx/ng/files/nginx.service
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
nginx_service:
|
||||
service.{{ service_function }}:
|
||||
{{ sls_block(nginx.service.opts) }}
|
||||
|
@ -21,10 +21,10 @@ get-openresty:
|
||||
install_openresty:
|
||||
cmd.wait:
|
||||
- cwd: {{ home }}/ngx_openresty-{{ openresty_version }}
|
||||
- names:
|
||||
- names:
|
||||
- ./configure --with-luajit \
|
||||
--with-http_drizzle_module \
|
||||
--with-http_postgres_module \
|
||||
--with-http_postgres_module \
|
||||
--with-http_iconv_module
|
||||
- make && make install
|
||||
- watch:
|
||||
|
@ -102,7 +102,7 @@ nginx:
|
||||
- require:
|
||||
- pkg: nginx
|
||||
- file: nginx-old-init
|
||||
- module: nginx-old-init
|
||||
- module: nginx-old-init
|
||||
{% endif %}
|
||||
service.running:
|
||||
- enable: True
|
||||
|
@ -216,7 +216,7 @@ nginx:
|
||||
{% if use_sysvinit %}
|
||||
- watch_in:
|
||||
{% set logger_types = ('access', 'error') %}
|
||||
{% for log_type in logger_types %}
|
||||
{% for log_type in logger_types %}
|
||||
- service: nginx-logger-{{ log_type }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
@ -1,23 +1,23 @@
|
||||
# nginx
|
||||
|
||||
|
||||
description "nginx http daemon"
|
||||
author "George Shammas <georgyo@gmail.com>"
|
||||
|
||||
|
||||
start on (runlevel [345] and started network)
|
||||
stop on (runlevel [!345] or stopping network)
|
||||
|
||||
|
||||
env DAEMON=/usr/sbin/nginx
|
||||
|
||||
|
||||
expect fork
|
||||
respawn
|
||||
respawn limit 10 5
|
||||
#oom never
|
||||
|
||||
|
||||
pre-start script
|
||||
$DAEMON -t
|
||||
if [ $? -ne 0 ]
|
||||
then exit $?
|
||||
fi
|
||||
end script
|
||||
|
||||
|
||||
exec $DAEMON
|
||||
|
@ -40,7 +40,7 @@ nginx:
|
||||
# Source install
|
||||
source_version: '1.10.0'
|
||||
source_hash: ''
|
||||
|
||||
|
||||
# These are usually set by grains in map.jinja
|
||||
# Typically you can comment these out.
|
||||
lookup:
|
||||
@ -56,7 +56,7 @@ nginx:
|
||||
# Currently it can be used on rhel/centos/suse when installing from repo
|
||||
gpg_check: True
|
||||
pid_file: /var/run/nginx.pid ### Prevent Rendering SLS error (map.jinja:149) if nginx.server.config.pid undefined (Ubuntu, etc) ###
|
||||
|
||||
|
||||
|
||||
# Source compilation is not currently a part of nginx.ng
|
||||
from_source: False
|
||||
@ -76,9 +76,9 @@ nginx:
|
||||
|
||||
# nginx.conf (main server) declarations
|
||||
# dictionaries map to blocks {} and lists cause the same declaration to repeat with different values
|
||||
config:
|
||||
config:
|
||||
source_path: salt://path_to_nginx_conf_file/nginx.conf # IMPORTANT: This option is mutually exclusive with the rest of the
|
||||
# options; if it is found other options (worker_processes: 4 and so
|
||||
# options; if it is found other options (worker_processes: 4 and so
|
||||
# on) are not processed and just upload the file from source
|
||||
worker_processes: 4
|
||||
pid: /var/run/nginx.pid ### Directory location must exist
|
||||
@ -108,22 +108,22 @@ nginx:
|
||||
# Remove the site config file. Nice to clean up the conf.d (or sites-available).
|
||||
# It also remove the symlink (if it is exists).
|
||||
# The site MUST be disabled before delete it (if not the nginx is not reloaded).
|
||||
deleted: True
|
||||
###########
|
||||
deleted: True
|
||||
###########
|
||||
## Modify 'available_dir' AND 'enabled_dir' '/etc/nginx' location to alternative value.
|
||||
###########
|
||||
available_dir: /etc/nginx/sites-available # an alternate directory (not sites-available) where this server may be found
|
||||
enabled_dir: /etc/nginx/sites-enabled # an alternate directory (not sites-enabled) where this server may be found
|
||||
disabled_name: mysite.aint_on # an alternative disabled name to be use when not symlinking
|
||||
overwrite: True # overwrite an existing server file or not
|
||||
|
||||
|
||||
# May be a list of config options or None, if None, no server file will be managed/templated
|
||||
# Take server directives as lists of dictionaries. If the dictionary value is another list of
|
||||
# dictionaries a block {} will be started with the dictionary key name
|
||||
config:
|
||||
- server:
|
||||
- server_name: localhost
|
||||
- listen:
|
||||
- listen:
|
||||
- 80
|
||||
- default_server
|
||||
- index:
|
||||
@ -134,7 +134,7 @@ nginx:
|
||||
- $uri
|
||||
- $uri/ =404
|
||||
- test: something else
|
||||
|
||||
|
||||
# The above outputs:
|
||||
# server {
|
||||
# server_name localhost;
|
||||
@ -144,7 +144,7 @@ nginx:
|
||||
# try_files $uri $uri/ =404;
|
||||
# test something else;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
mysite2: # Using source_path options to upload the file instead of templating all the file
|
||||
enabled: True
|
||||
available_dir: /etc/nginx/sites-available
|
||||
|
Loading…
Reference in New Issue
Block a user