mirror of
https://github.com/geerlingguy/ansible-role-nginx.git
synced 2024-09-28 04:07:26 +02:00
Change README vhost example for the common SSL option with a http redirect
This commit is contained in:
parent
98b736f479
commit
4c5df1faea
15
README.md
15
README.md
@ -19,7 +19,7 @@ Available variables are listed below, along with default values (see `defaults/m
|
||||
A list of vhost definitions (server blocks) for Nginx virtual hosts. Each entry will create a separate config file named by `server_name`. 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"
|
||||
- listen: "443 ssl http2"
|
||||
server_name: "example.com"
|
||||
server_name_redirect: "www.example.com"
|
||||
root: "/var/www/example.com"
|
||||
@ -38,11 +38,24 @@ A list of vhost definitions (server blocks) for Nginx virtual hosts. Each entry
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
|
||||
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
|
||||
ssl_protocols TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
An example of a fully-populated nginx_vhosts entry, using a `|` to declare a block of syntax for the `extra_parameters`.
|
||||
|
||||
Please take note of the indentation in the above block. The first line should be a normal 2-space indent. All other lines should be indented normally relative to that line. In the generated file, the entire block will be 4-space indented. This style will ensure the config file is indented correctly.
|
||||
|
||||
- listen: "80"
|
||||
server_name: "example.com www.example.com"
|
||||
return "301 https://example.com$request_uri;"
|
||||
vhost_filename: "example.com.80.conf"
|
||||
|
||||
An example of a secondary vhost which will redirect to the one shown above.
|
||||
|
||||
*Note: The `vhost_filename` defaults to the first domain in `server_name`, if you have two vhosts with the same domain, eg. a redirect, you need to manually set the `vhost_filename` so the second one doesn't override the first one*
|
||||
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user