Varnish will be running on the port 80
. So, Apache should be running on any other port then port 80
. I personally prepare to use port 81
for Apache as port 8080
is normal used by Apache Tomcat.
Listening Apache on port 81
.
httpd.conf (/etc/httpd/conf/httpd.conf).
Listen 81
NameVirtualHost *:81
Default configuration file for Varnish. default.vcl (/etc/varnish/default.vcl).
backend default {
.host = "127.0.0.1";
.port = "81";
}
Virtual Host for sub1.example.net and sub2.example.net. vhosts.conf (/etc/httpd/conf.d/vhosts/example.net.conf).
# vhost : sub1.example.net
<VirtualHost *:81>
...
ServerName sub1.example.net
...
<Directory "/var/www/html/vhosts/example.net/sub1/public_html">
...
</Directory>
...
</VirtualHost>
# vhost : sub2.example.net
<VirtualHost *:81>
...
ServerName sub2.example.net
...
<Directory "/var/www/html/vhosts/example.net/sub2/public_html">
...
</Directory>
...
</VirtualHost>