|
| 1 | +Nginx Drupal |
| 2 | +============ |
| 3 | + |
| 4 | +Ansible role to configure Nginx for running Drupal using [perusio's configuration](https://github.com/perusio/drupal-with-nginx). |
| 5 | + |
| 6 | +This role only configure Nginx to run Drupal sites, it will not install PHP, |
| 7 | +Nginx, Drupal, MySQL, etc. It will however, override the entire content of the |
| 8 | +Nginx configuration directory. You can still add file to the Nginx configuration |
| 9 | +directory after this role. |
| 10 | + |
| 11 | +Requirements |
| 12 | +------------ |
| 13 | + |
| 14 | +- Git |
| 15 | +- A `reload nginx` handler is used to reload Nginx after configuration changes |
| 16 | + and must be defined in your playbook. |
| 17 | + |
| 18 | +Role Variables |
| 19 | +-------------- |
| 20 | + |
| 21 | +The following variables are available to configure the role: |
| 22 | + |
| 23 | +- **nginx_drupal_git** |
| 24 | + - **repo**: The URL of the Git repository to checkout the base |
| 25 | + configuration from, defaults to https://github.com/perusio/drupal-with-nginx.git |
| 26 | + - **version** The version of the version of the repository to |
| 27 | + check out. This can be the full 40-character SHA-1 hash, the literal string |
| 28 | + HEAD, a branch name, or a tag name. Defaults to 'D7'. |
| 29 | +- **nginx_drupal_config_path**: The path to Nginx configuration folder, |
| 30 | + defaults to "/etc/nginx". |
| 31 | +- **nginx_drupal_log_path**: The path to Nginx log files, defaults to |
| 32 | + "/var/log/nginx" |
| 33 | +- **nginx_drupal_php_handling**: The PHP handling method, one of "php-fpm", |
| 34 | + "php-cgi" or "proxy", defaults to "php-fpm". |
| 35 | +- **nginx_drupal_escape_uri**: Whether or not to escaped URIs, defaults to |
| 36 | + false. **No implemented** |
| 37 | +- **nginx_drupal_use_boost**: Whether or not [Boost](http://drupal.org/project/boost) |
| 38 | + is used, defaults to false. **No implemented** |
| 39 | +- **nginx_drupal_use_drush**: Whether or not [Drush](https://github.com/drush-ops/drush) |
| 40 | + is used, defaults to true. |
| 41 | +- **nginx_drupal_allow_install**: Whether or not to allow access to the |
| 42 | + ```install.php``` file, defaults to false. |
| 43 | +- **nginx_drupal_use_spdy**: Whether or not to use SPDY, defaults to false. |
| 44 | +- **nginx_drupal_nginx_status_allowed_hosts**: The list of host allowed to |
| 45 | + access Nginx status page, defaults to ```["127.0.0.1", "192.168.1.0/24"]```. |
| 46 | +- **nginx_drupal_php_fpm_status_allowed_hosts**: The list of host allowed to |
| 47 | + access PHP-FPM status page, defaults to ```["127.0.0.1", "192.168.1.0/24"]```. |
| 48 | +- **nginx_drupal_hotlinking_protection**: Whether or not to prevent image |
| 49 | + hotlinking, defaults to false. |
| 50 | +- **nginx_drupal_admin_basic_auth**: Whether or not to protect access to admin |
| 51 | + pages (```/admin/*```) using HTTP auth, defaults to false. |
| 52 | +- **nginx_drupal_microcache**: Whether or not to use microcaching, defaults to |
| 53 | + true. |
| 54 | +- **nginx_drupal_microcache_auth**: Whether or not to use microcaching for |
| 55 | + authenticated users, defaults to false. |
| 56 | +- **nginx_drupal_upload_progress**: Whether or not to use upload progress (this |
| 57 | + require the |
| 58 | +- **nginx_drupal_use_aio**: Whether or not to use AIO to server video and audio |
| 59 | + file, defaults to true. |
| 60 | +- **nginx_drupal_flv_streaming**: Whether or not to use FLV pseudo streaming |
| 61 | + (cf. http://wiki.nginx.org/HttpFlvStreamModule), defaults to false. |
| 62 | +- **nginx_drupal_mp4_streaming**: Whether or not to use MP4 streaming, (cf. |
| 63 | + http://nginx.org/en/docs/http/ngx_http_mp4_module.html) defaults to false. |
| 64 | +- **nginx_drupal_upstream_servers**: The list of PHP upstream servers, each item |
| 65 | + is a server address (and parameters, see |
| 66 | + http://nginx.org/en/docs/http/ngx_http_upstream_module.html#server), defaults |
| 67 | + to ```["unix:/var/run/php-fpm.sock", "php-fpm-zwei.sock"]```. |
| 68 | +- **nginx_drupal_upstream_backup_servers**: The list of PHP upstream backup |
| 69 | + servers, defaults to ```["unix:/var/run/php-fpm-bkp.sock"]```. |
| 70 | +- **nginx_drupal_sites**: The list of available sites. |
| 71 | + Each site uses the following structure: |
| 72 | + - **file_name**: The name of the site configuration file. |
| 73 | + - **http**: HTTP server configuration (leave empty to disable HTTP) |
| 74 | + - **port**: The port to listen on |
| 75 | + - **https**: HTTPS server configuration (leave empty to disable HTTPS) |
| 76 | + - **port**: The port to listen on |
| 77 | + - **certificate**: Path to the SSL certificate of the server (in the PEM |
| 78 | + format). |
| 79 | + - **certificate_key**: Path to the SSL secret key of the server (in the |
| 80 | + PEM format). |
| 81 | + - **server_name**: The (primary) server name. |
| 82 | + - **ipv6**: (optional) IPv6 address of the server |
| 83 | + - **alternate_server_name**: (optional) Alternate server name, configured as |
| 84 | + redirect to the primary server site. This can be used to remove the |
| 85 | + ```www.``` prefix. |
| 86 | + - **root**: Path to the root directory for the site. |
| 87 | + - **limit_conn**: (optional) The limit_conn for the site (defaults to |
| 88 | + ```arbeit 32```). |
| 89 | + - **enabled**: Whether or not the site should be enabled (defaults to true). |
| 90 | + |
| 91 | + |
| 92 | +Examples |
| 93 | +-------- |
| 94 | + |
| 95 | +Two Drupal 7 sites, one available in HTTP and HTTPS. The other only available in |
| 96 | +HTTPS but disabled. |
| 97 | + |
| 98 | + |
| 99 | + - hosts: all |
| 100 | + roles: |
| 101 | + - role: nginx-drupal |
| 102 | + nginx_drupal_sites: |
| 103 | + - file_name: foo |
| 104 | + server_name: foo.org |
| 105 | + alternate_server_name: www.foo.org |
| 106 | + root: /var/www/foo |
| 107 | + http: |
| 108 | + port: 80 |
| 109 | + https: |
| 110 | + port: 443 |
| 111 | + certificate: /etc/nginx/ssl/foo.cert |
| 112 | + certificate_key: /etc/nginx/ssl/foo.key |
| 113 | + - file_name: bar |
| 114 | + server_name: bar.org |
| 115 | + alternate_server_name: www.bar.org |
| 116 | + root: /var/www/bar |
| 117 | + enabled: false |
| 118 | + https: |
| 119 | + port: 443 |
| 120 | + certificate: /etc/nginx/ssl/bar.cert |
| 121 | + certificate_key: /etc/nginx/ssl/bar.key |
| 122 | + |
| 123 | +Nginx as a Reverse Proxy for a single Drupal 6 sites, without microcaching and |
| 124 | +with image hot linking protection. |
| 125 | + |
| 126 | + |
| 127 | + - hosts: all |
| 128 | + roles: |
| 129 | + - role: nginx-drupal |
| 130 | + nginx_drupal_git: |
| 131 | + version: D6 |
| 132 | + nginx_drupal_hotlinking_protection: true |
| 133 | + nginx_drupal_php_handling: proxy |
| 134 | + nginx_drupal_microcache: false |
| 135 | + nginx_drupal_sites: |
| 136 | + - file_name: foo |
| 137 | + server_name: foo.org |
| 138 | + alternate_server_name: www.foo.org |
| 139 | + root: /var/www/foo |
| 140 | + http: |
| 141 | + port: 80 |
| 142 | + |
| 143 | +License |
| 144 | +------- |
| 145 | + |
| 146 | +GPLv3 |
| 147 | + |
| 148 | +Author Information |
| 149 | +------------------ |
| 150 | + |
| 151 | +Pierre Buyle <buyle@pheromone.ca> |
0 commit comments