From a08f8cda11c669c0925dbd21b62c2008d70d86b8 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 3 Sep 2015 16:24:58 -0500 Subject: [PATCH] Fixes #20: Add example of a complete nginx_vhosts entry with extra_parameters. --- README.md | 18 ++++++++++++++++++ defaults/main.yml | 20 ++++++++------------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 00bfb8a..6e92a26 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,24 @@ Available variables are listed below, along with default values (see `defaults/m A list of vhost definitions (server blocks) for Nginx virtual hosts. If left empty, you will need to supply your own virtual host configuration. See the commented example in `defaults/main.yml` for available server options. If you have a large number of customizations required for your server definition(s), you're likely better off managing the vhost configuration file yourself, leaving this variable set to `[]`. + nginx_vhosts: + - listen: "80 default_server" + server_name: "example.com" + root: "/var/www/example.com" + index: "index.php index.html index.htm" + error_page: "" + access_log: "" + extra_parameters: | + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + +An example of a fully-populated nginx_vhosts entry, using a `|` to declare a block of syntax for the `extra_parameters`. + nginx_remove_default_vhost: false Whether to remove the 'default' virtualhost configuration supplied by Nginx. Useful if you want the base `/` URL to be directed at one of your own virtual hosts configured in a separate .conf file. diff --git a/defaults/main.yml b/defaults/main.yml index 8c51fc6..3a075c0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -22,25 +22,21 @@ nginx_proxy_cache_path: "" nginx_remove_default_vhost: false nginx_vhosts: [] # Example vhost below, showing all available options: -# - { -# listen: "80 default_server", # default: "80 default_server" -# server_name: "example.com", # default: N/A -# root: "/var/www/example.com", # default: N/A -# index: "index.html index.htm", # default: "index.html index.htm" +# - listen: "80 default_server" # default: "80 default_server" +# server_name: "example.com" # default: N/A +# root: "/var/www/example.com" # default: N/A +# index: "index.html index.htm" # default: "index.html index.htm" # # # Properties that are only added if defined: -# error_page: "", -# access_log: "", +# error_page: "" +# access_log: "" # extra_parameters: "" # Can be used to add extra config blocks (multiline). -# } nginx_upstreams: [] -# - { -# name: myapp1, -# strategy: "ip_hash", # "least_conn", etc. +# - name: myapp1 +# strategy: "ip_hash" # "least_conn", etc. # servers: { # "srv1.example.com", # "srv2.example.com weight=3", # "srv3.example.com" # } -# }