You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
Jeff Geerling 45713939ee Cleanup - This nginx role now works across RedHat and Debian. 10 years ago
files Initial commit. 10 years ago
handlers Initial commit. 10 years ago
meta Cleanup - This nginx role now works across RedHat and Debian. 10 years ago
tasks Cleanup - This nginx role now works across RedHat and Debian. 10 years ago
templates Update Nginx role to be more customizable. 10 years ago
vars Updated default connection limit. 10 years ago
README.md Cleanup - This nginx role now works across RedHat and Debian. 10 years ago

README.md

Ansible Role: Nginx

Installs Nginx on RedHat/CentOS or Debian/Ubuntu linux servers.

This role installs and configures the latest version of Nginx from the Nginx yum repository (on RedHat-based systems) or via apt (on Debian-based systems). You will likely need to do extra setup work after this role has installed Nginx, like adding your own [virtualhost].conf file inside /etc/nginx/conf.d/, describing the location and options to use for your particular website.

Requirements

None.

Role Variables

Available variables are listed below, along with default values (see vars/main.yml):

nginx_user: "nginx"

The user under which Nginx will run.

nginx_worker_processes: "1"
nginx_worker_connections: "8192"

nginx_worker_processes should be set to the number of cores present on your machine. Connections (find this number with grep processor /proc/cpuinfo | wc -l). nginx_worker_connections is the number of connections per process. Set this higher to handle more simultaneous connections (and remember that a connection will be used for as long as the keepalive timeout duration for every client!).

nginx_client_max_body_size: "64m"

This value determines the largest file upload possible, as uploads are passed through Nginx before hitting a backend like php-fpm. If you get an error like client intended to send too large body, it means this value is set too low.

nginx_keepalive_timeout: "65"

The keepalive timeout. Should be set higher (10s+) if you have more polling-style traffic (AJAX-powered sites especially), or lower (<10s) if you have a site where most users visit a few pages and don't send any further requests.

Dependencies

None.

Example Playbook

- hosts: server
  roles:
    - { role: geerlingguy.nginx }

License

MIT / BSD

Author Information

This role was created in 2014 by Jeff Geerling, author of Ansible for DevOps.