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
[](https://github.com/ddev/ddev-varnish/actions/workflows/tests.yml)
This repository allows you to quickly install the Varnish reverse proxy into a [DDEV](https://ddev.readthedocs.io) project using the instructions below.
8
+
## Overview
6
9
7
-
## Installation
8
-
9
-
For DDEV v1.23.5 or above run
10
-
11
-
```sh
12
-
ddev add-on get ddev/ddev-varnish
13
-
```
10
+
[Varnish Cache](https://varnish-cache.org/) is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture.
14
11
15
-
For earlier versions of DDEV run
12
+
This add-on integrates Varnish into your [DDEV](https://ddev.com/) project.
16
13
17
-
```sh
18
-
ddev get ddev/ddev-varnish
19
-
```
20
-
21
-
Then restart your project
14
+
## Installation
22
15
23
-
```sh
16
+
```bash
17
+
ddev add-on get ddev/ddev-varnish
24
18
ddev restart
25
19
```
26
20
27
21
> [!NOTE]
28
-
> If you change `additional_hostnames` or `additional_fqdns`, you have to re-run `ddev add-on get ddev/ddev-varnish`
22
+
> Run `ddev add-on get ddev/ddev-varnish` after changes to `name`, `additional_hostnames`, `additional_fqdns`, or `project_tld` in `.ddev/config.yaml` so that `.ddev/docker-compose.varnish_extras.yaml` is regenerated.
29
23
30
-
## Explanation
24
+
After installation, make sure to commit the `.ddev` directory to version control.
31
25
32
-
The Varnish service inserts itself between ddev-router and the web container, so that calls
33
-
to the web container are routed through Varnish first. The [docker-compose.varnish.yaml](docker-compose.varnish.yaml)
34
-
installs Varnish and uses the default domain as its own host name. A `docker-compose.varnish_extras.yaml` file is generated on install which replaces the `VIRTUAL_HOST` variable of the web container with a sub-domain of the website URL. For example, `mysite.ddev.site`, would be accessible via Varnish on `mysite.ddev.site` and directly on `novarnish.mysite.ddev.site`.
26
+
## Usage
35
27
36
-
If you use a `project_tld` other than `ddev.site` or `additional_fqdns` DDEV will help add hosts entries for the hostnames automagically; however, you'll need to add entries for the `novarnish.*` sub-domains yourself, e.g. `ddev hostname novarnish.testaddfqdn.random.tld 127.0.0.1`.
28
+
The Varnish service inserts itself between ddev-router and the web container, so that calls to the web container are routed through Varnish first. The [docker-compose.varnish.yaml](docker-compose.varnish.yaml) installs Varnish and uses the default domain as its own host name.
37
29
38
-
Run `ddev add-on get ddev/ddev-varnish` after changes to `name`, `additional_hostnames`, `additional_fqdns`, or `project_tld` in `.ddev/config.yaml` so that `.ddev/docker-compose.varnish_extras.yaml` is regenerated.
30
+
A `docker-compose.varnish_extras.yaml` file is generated on install which replaces the `VIRTUAL_HOST` variable of the web container with a sub-domain of the website URL. For example, `mysite.ddev.site`, would be accessible via Varnish on `mysite.ddev.site` and directly on `novarnish.mysite.ddev.site`.
39
31
40
-
## Helper commands
32
+
If you use a `project_tld` other than `ddev.site` or `additional_fqdns` DDEV will help add hosts entries for the hostnames automagically; however, you'll need to add entries for the `novarnish.*` sub-domains yourself, e.g. `ddev hostname novarnish.testaddfqdn.random.tld 127.0.0.1`.
41
33
42
-
This addon also providers several helper commands. These helpers allow developers to run Varnish commands from the host, however, the commands are actually run inside the Varnish container.
34
+
## Helper Commands
35
+
36
+
This add-on also providers several helper commands. These helpers allow developers to run Varnish commands from the host, however, the commands are actually run inside the Varnish container.
43
37
44
38
| Command | Description |
45
39
| --- | --- |
@@ -51,13 +45,32 @@ This addon also providers several helper commands. These helpers allow developer
See [The Varnish Reference Manual](https://varnish-cache.org/docs/6.0/reference/index.html) for more information about the commands, their flags, and their arguments.
51
+
52
+
## Advanced Customization
53
+
54
+
You may want to edit the `.ddev/varnish/default.vcl` to meet your needs. Remember to remove `#ddev-generated` from the file if you want your changes to the file preserved.
55
+
56
+
To change the Docker image:
57
+
58
+
```bash
59
+
ddev dotenv set .ddev/.env.varnish --varnish-docker-image=varnish:6.0
60
+
ddev add-on get ddev/ddev-varnish
61
+
ddev restart
62
+
```
63
+
64
+
Make sure to commit the `.ddev/.env.varnish` file to version control.
54
65
55
-
See [The Varnish Reference Manual](https://varnish-cache.org/docs/6.5/reference/index.html) for more information about the commands, their flags, and their arguments.
* You may want to edit the `.ddev/varnish/default.vcl` to meet your needs. Remember to remove `#ddev-generated` from the file if you want your changes to the file preserved.
72
+
## Credits
60
73
61
-
**Maintained by [@jedubois](https://github.com/jedubois) and [@rfay](https://github.com/rfay)**
74
+
**Maintained by [@jedubois](https://github.com/jedubois) and the [DDEV team](https://ddev.com/support-ddev/)**
62
75
63
76
**Based on the original [ddev-contrib recipe](https://github.com/ddev/ddev-contrib/tree/master/docker-compose-services/varnish) pioneered by [rikwillems](https://github.com/rikwillems)**
0 commit comments