Last week I installed Varnish and my websites are now working fine with it - I can navigate and change them without error. Back when I installed it, I putted Varnish on port 80 and moved Apache to port 8080.
I later noticed that if I run the following in my browser I can't access phpmyadmin:
MY_IP:80/phpmyadmin MY_IP:8080/phpmyadmin
Yet, if I move phpmyadmin to say /var/www/html/site_dir/phpmyadmin I can indeed access it without a problem via domain.tld/phpmyadmin
But here's something strange, it now seems that nothing with an IP_ADDRESS works, not even the site which works without it in the browser:
MY_IP/domain.tld MY_IP/domain.tld/phpmyadmin MY_IP:8080/domain.tld/phpmyadmin
My question is why couldn't I access anything in server with an IP besides the Apache index.html page, from any browser?
The way I installed Varnish is this:
cd ~
apt-get update && apt-get install varnish -y
sed -i 's/Listen 80/Listen 8080/g' /etc/apache2/ports.conf
sed -i 's/\*\:80/\*\:8080/g' /etc/apache2/sites-available/000-default.conf
sed -i 's/\*\:80/\*\:8080/g' /etc/apache2/sites-available/domain.tld.conf && domain.tld.conf
mkdir -p /etc/systemd/system/varnish.service.d # Be aware! You might not need this in the future.
cat <<-'VARNISH' > /etc/systemd/system/varnish.service.d/customexec.conf
[Service]
ExecStart=
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
VARNISH
systemctl restart apache2.service && systemctl daemon-reload && systemctl restart varnish.service