Logging in via SSH
The first thing you need to do is gain access to the system via
- If you're on Windows you'll have to download PuTTY.
- If you're a Mac user, you can use the Terminal app to run
The SSH protocol runs over port
22 and gaining access happens either via username & password, or via an SSH key.
Here's an example where you use the
ssh binary on the command line to gain access to the
example.com server via the
If a valid SSH private key was configured on your computer, and a valid public key was configured on the server, you will get access to the server without providing a password. If that's not the case, you will be prompted for a password
Placing the VCL in the right place
Once you're on the system, you have to place your VCL file in the right directory.
The tutorial you mentioned uses the following command to make sure you have a backup of your original VCL file:
mv /etc/varnish/default.vcl /etc/varnish/default.vcl.BACK
There are various was to put the new VCL content in
/etc/varnish/default.vcl. You can use local editors such as
nano. You can also transfer content from your computer to the server via
scp binary is just like the
ssh binary: it takes the same credentials, it uses the same protocol.
scp is designed to transfer files from your local system to the server.
Here's an example command:
scp /path/to/vcl/default.vcl firstname.lastname@example.org:/etc/varnish/default.vcl
This command will take the VCL file that is in
/path/to/vcl/default.vcl on your local computer, and will send it to
/etc/varnish/default.vcl on the server.
If you're a Windows user, you can also use WinSCP to drag and drop your VCL file to the right folder.
Modifying systemd ExecStart settings
If you want to change some of the runtime parameters, you can do this by running the following command:
sudo systemctl edit --full varnish
Your tutorial mentions this as well, and uses it to change the listening port.
There are plenty of other options you can configure. See http://varnish-cache.org/docs/6.4/reference/varnishd.html#http-accelerator-daemon for a complete overview.
Reloading the configuration
Once the correct VCL file is in the right place and the systemd settings are updated, you have to reload Varnish. But if you changed systemd, you also need to reload the systemd daemon.
Just to be on the safe side, please run the following 2 commands:
sudo systemctl daemon-reload
sudo systemctl restart varnish