Skip to content

Commit

Permalink
Implement nginx_events_params and worker_connections to it
Browse files Browse the repository at this point in the history
  • Loading branch information
NBZ4live committed May 19, 2015
1 parent 5093bda commit 5720a9d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ The variables that can be passed to this role and a brief description about
them are as follows.

```yaml
# The max clients allowed
nginx_max_clients: 512

# The user to run nginx
nginx_user: "www-data"

# A list of directives for the events section.
nginx_events_params:
- worker_connections 512
- debug_connection 127.0.0.1
- use epoll
- multi_accept on

# A list of hashs that define the servers for nginx,
# as with http parameters. Any valid server parameters
# can be defined here.
Expand Down
4 changes: 3 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ nginx_group: "{{nginx_user}}"
nginx_pid_file: '/var/run/{{nginx_service_name}}.pid'

nginx_worker_processes: "{{ ansible_processor_vcpus }}"
nginx_max_clients: 512
nginx_worker_rlimit_nofile: 1024
nginx_log_dir: "/var/log/nginx"

nginx_events_params:
- worker_connections {% if nginx_max_clients %}{{nginx_max_clients}}{% else %}512{% endif %}

nginx_http_params:
- sendfile "on"
- tcp_nopush "on"
Expand Down
7 changes: 4 additions & 3 deletions example-vars.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
# The max clients allowed
nginx_max_clients: 512

# The user to run nginx
nginx_user: "www-data"

Expand All @@ -16,6 +13,10 @@ nginx_hhvm: |
include fastcgi_params;
}
# A list of directives for the events section.
nginx_events_params:
- worker_connections 512

# A list of hashs that define the servers for nginx,
# as with http parameters. Any valid server parameters
# can be defined here.
Expand Down
4 changes: 3 additions & 1 deletion templates/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ pid {{ nginx_pid_file }};
worker_rlimit_nofile {{ nginx_worker_rlimit_nofile }};

events {
worker_connections {{ nginx_max_clients }};
{% for v in nginx_events_params %}
{{ v }};
{% endfor %}
}


Expand Down

0 comments on commit 5720a9d

Please sign in to comment.