In nginx
, you have to change to port in the config file that holds your vhost config.
Usualy listen 80
is somewhere in that file. Replace it with listen 8080
.
For varnish
, the listen port is part of the systemd
config file. By default it is hosted in /lib/systemd/system/varnish.service
, but it should be copied to /etc/systemd/system/varnish.service
.
In the varnish.service
file you'll find something like -a :6081
, which should be replaced by -a :80
.
After you've made the changes to the varnish.service
file, you need to reload the systemd
daemon by running sudo systemctl daemon-reload
.
And finally, it's a matter of restarting nginx
& varnish
using the restart commands that systemd
offers.
Here's the all-in-one command that does all this for you:
sudo sed -i 's/80/8080/' /etc/nginx/sites-enabled/default
sudo cp -f /lib/systemd/system/varnish.service /etc/systemd/system/varnish.service
sudo sed -i 's/-a :6081/-a :80/' /etc/systemd/system/varnish.service
sudo systemctl daemon-reload
sudo systemctl restart nginx
sudo systemctl restart varnish
These are my assumptions about these commands:
- Your
nginx
vhost conf file is /etc/nginx/sites-enabled/default
- Your
varnish
is in its out-of-the-box config, and still listens on port 6081