You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 13, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -91,7 +91,7 @@ Note: *If there are any errors during the course of running `vagrant up`, and it
91
91
### 3 - Configure your host machine to access the VM.
92
92
93
93
1.[Edit your hosts file](http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file), adding the line `192.168.88.88 drupalvm.dev` so you can connect to the VM.
94
-
- You can have Vagrant automatically configure your hosts file if you install the `hostsupdater` plugin (`vagrant plugin install vagrant-hostsupdater`). All hosts defined in `apache_vhosts` or `nginx_hosts` will be automatically managed. `vagrant-hostmanager` is also supported.
94
+
- You can have Vagrant automatically configure your hosts file if you install the `hostsupdater` plugin (`vagrant plugin install vagrant-hostsupdater`). All hosts defined in `apache_vhosts` or `nginx_vhosts` will be automatically managed. `vagrant-hostmanager` is also supported.
95
95
- The `auto_network` plugin (`vagrant plugin install vagrant-auto_network`) can help with IP address management if you set `vagrant_ip` to `0.0.0.0` inside `config.yml`.
96
96
2. Open your browser and access [http://drupalvm.dev/](http://drupalvm.dev/). The default login for the admin account is `admin` for both the username and password.
Copy file name to clipboardExpand all lines: docs/configurations/webservers-nginx.md
+42-2
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
To use Nginx instead of Apache, change the `drupalvm_webserver` variable inside your customized `config.yml`, from `apache` to `nginx`.
2
2
3
-
Because Nginx server directives behave a little differently than Apache's VirtualHosts, Drupal VM includes a custom Drupal-optimized Nginx server block configuration, and you can control all the servers ('virtual hosts') Nginx will run using the `nginx_hosts` configuration. A few simple examples are shown in `default.config.yml`, but you have some extra flexibility if you need it. See the `nginx-vhost.conf.j2` template for more information.
3
+
Because Nginx server directives behave a little differently than Apache's VirtualHosts, Drupal VM includes a custom Drupal-optimized Nginx server block configuration, and you can control all the servers ('virtual hosts') Nginx will run using the `nginx_vhosts` configuration. A few simple examples are shown in `default.config.yml`, but you have some extra flexibility if you need it. See the `nginx-vhost.conf.j2` template for more information.
4
4
5
5
Also, see the examples included in the [`geerlingguy.nginx` Ansible role's README](https://github.com/geerlingguy/ansible-role-nginx#readme) for more info, as well as many other variables you can override to configure Nginx exactly how you like it.
6
6
@@ -10,7 +10,7 @@ _Note: if you're using php-fpm, you may want to reflect your use of nginx by set
10
10
11
11
To enable SSL support for you virtual hosts you first need a certificate file. See the same section under the [Apache documentation](webservers-apache.md#enable-ssl-support-with-apache) for how to generate a self-signed certficiate.
12
12
13
-
Modify your nginx host configuration by adding the following `extra_parameters` to the first entry in `nginx_hosts`:
13
+
Modify your nginx host configuration by adding the following `extra_parameters` to the first entry in `nginx_vhosts`:
@@ -39,3 +39,43 @@ If you are using Ubuntu as your base OS and you want to get started quickly with
39
39
ssl_protocols TLSv1.1 TLSv1.2;
40
40
ssl_ciphers HIGH:!aNULL:!MD5;
41
41
```
42
+
43
+
## Customizing server block configuration
44
+
45
+
If you can't customize via variables because an option isn't exposed, you can override the template used to generate the the virtualhost configuration file.
You can either copy and modify the provided `nginx-vhost.conf.j2` template, or extend it and use [template inheritace](http://jinja.pocoo.org/docs/2.9/templates/#template-inheritance) to override the specific template block you need to change.
52
+
53
+
_If you extend Drupal VM's provided base template, the path referenced should to be relative to playbook.yml._
54
+
55
+
```
56
+
{% extends 'templates/nginx-vhost.conf.j2' %}
57
+
58
+
{% block location_primary %}
59
+
location / {
60
+
try_files $uri @rewrite; # For Drupal <= 6
61
+
}
62
+
{% endblock %}
63
+
64
+
{% block location_image_styles %}
65
+
location ~ ^/sites/.*/files/imagecache/ {
66
+
try_files $uri @rewrite; # For Drupal <= 6
67
+
}
68
+
{% endblock %}
69
+
```
70
+
71
+
If you need to append or prepend content to a block, you can use the `{{ super() }}` Jinja2 function to return the original block content from the base template.
Copy file name to clipboardExpand all lines: docs/deployment/multisite.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
For multisite installations, make the changes outlined in the [Local Drupal codebase](local-codebase.md) guide, but, using the `apache_vhosts` variable (or `nginx_hosts` if using Nginx), configure as many domains pointing to the same docroot as you need:
1
+
For multisite installations, make the changes outlined in the [Local Drupal codebase](local-codebase.md) guide, but, using the `apache_vhosts` variable (or `nginx_vhosts` if using Nginx), configure as many domains pointing to the same docroot as you need:
Copy file name to clipboardExpand all lines: docs/extras/drush.md
+16
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,22 @@ $ drush @drupalvm.dev status
35
35
36
36
Drupal VM automatically generates a drush alias file in `~/.drush/drupalvm.aliases.drushrc.php` with an alias for every site you have defined in the `apache_vhosts` variable.
37
37
38
+
If you want to customize the generated alias file you can override the `drush_aliases_host_template` and `drush_aliases_guest_template` variables in your `config.yml`.
Eg. to only print the alias for your main domain, and not the subdomain you can override the file using a [Jinja2 child template](http://jinja.pocoo.org/docs/2.9/templates/#child-template).
You can disable Drupal VM's automatic Drush alias file management if you want to manage drush aliases on your own. Just set the `configure_drush_aliases` variable in `config.yml` to `false`.
If you don't set these values, Drupal will think all requests are coming from `127.0.0.1`. There are other settings you can change to make Drupal not store copies of cached pages in the Database (since Varnish is caching everything, this is redundant), but those other settings are not covered here.
33
33
34
+
## Extending the base `drupalvm.vcl.j2` template
35
+
36
+
If you can't customize via variables because an option isn't exposed, you can extend the base `drupalvm.vcl.j2` through [Jinja2 template inheritance](http://jinja.pocoo.org/docs/2.9/templates/#template-inheritance).
Either copy the `drupalvm.vcl.j2` and modify it to your liking, or extend it and override the blocks you need to adjust.
43
+
44
+
_If you extend Drupal VM's provided base template, the path referenced should to be relative to playbook.yml._
45
+
46
+
```
47
+
{% extends 'templates/drupalvm.vcl.j2' %}
48
+
49
+
{% block backend -%}
50
+
{{ super() }}
51
+
.connect_timeout = 1s;
52
+
{% endblock %}
53
+
54
+
{% block vcl_deliver -%}
55
+
unset resp.http.X-Url;
56
+
unset resp.http.X-Host;
57
+
unset resp.http.Purge-Cache-Tags;
58
+
# Do not set X-Varnish-Cache headers.
59
+
{% endblock %}
60
+
```
61
+
62
+
The [`{{ super() }}` Jinja2 function](http://jinja.pocoo.org/docs/2.9/templates/#super-blocks) returns the original block content from the base template.
63
+
34
64
For a list of available role variables, see the [`geerlingguy.varnish` Ansible role's README](https://github.com/geerlingguy/ansible-role-varnish#readme).
0 commit comments