Wednesday, 14 August 2013

How to configure mutiple apache virtual hosts on mutiple ports?

How to configure mutiple apache virtual hosts on mutiple ports?

I have a server with one IP address. I want to run several virtual hosts
in an Apache 2.2. And I want all virtual hosts to be accessible on port 80
(plain http), 8000 (plain http) and 443 (ssl).
For example, I have two virtual hosts a.foo.com and b.foo.com. I want the
following url to be accessable: http://a.foo.com, http://a.foo.com:8000,
https://a.foo.com, http://b.foo.com, http://b.foo.com:8000 and
https://b.foo.com. The virtual host a.foo.com should have the same content
on all ports.
Here is my failed attempt. I haven't come to the SSL yet. I can't even
figure out just the two plain http ports.
Listen 80
Listen 8000
NameVirtualHost *
<VirtualHost *>
ServerName a.foo.com
DocumentRoot /www/a
</VirtualHost>
<VirtualHost *>
ServerName a.foo.com
DocumentRoot /www/a
</VirtualHost>

No comments:

Post a Comment