I’m running multiple websites on a single server with one dedicated IP address from my ISP. I’d like to create a virtual host with a new local ip in order to run SSL for the second domain (ssl is already installed for another domain and local IP). The problem is after creating the virtual host and then assigning my new site to use this IP, when I try to enter the website through the domain, all I see is the “It Works!” default apache page.
What have I done wrong or what other steps do I need to take?
My hunch is that the requests aren’t ending up on the correct IP address.
However, I’m trying to wrap my head around your setup/architecture there, so bear with me
The IP addresses you’re listing above – are those the actual ones being used on your server (and not just examples)?
If so, that suggests that you have another system in front of your server, perhaps forwarding requests to your server?
If that’s the case – in most cases it would need two different IP addresses on it in order to be able to forward to the correct IP of your server (unless you’re doing some sort of special proxying/filtering there).
So my suggestions are:
Make absolute certain that the requests are going to the correct IP address; verify the DNS for the domains, and check with any systems that you have doing forwarding to make sure they’re forwarding to the correct IP.
Verify that the domain in question is listed as either the “ServerName” or “ServerAlias” in your Apache config file.
I have a wired router with a static ip address connected to the server. The DNS for the domains is pointed to the static IP address. On the machine I’ve setup both local IP addresses in the interfaces file.
So you have two IP addresses on your server, but only one on your router, it sounds like – how does your router know whether to route a given request to one IP on your server versus the other?
As far as the ServerName/ServerAlias in the Apache config goes – that part is normally handled by Virtualmin – I’m just suggesting that you may want to take a peek in the config file and make sure it’s there as you’d expect.
I’ve setup both local IPs in /etc/network/interfaces which I thought was sufficient.
That is indeed step 1! There’s a step 2 though –
Is there something I need to be doing on my router as well?
Well, here’s the thing… lets say you have the domain “example2.com” setup in Apache, using something like <VirtualHost 192.168.1.199:80>.
The key there is that it’s on .199.
If your router is only forwarding requests into .198, Apache won’t ever notice the VirtualHost block for example2.com, as it’s on a different IP.
So somehow, you need your router to know which IP on your server to be forwarding the requests to.
Barring a really intelligent router, the only real way to do that would be to have two IP addresses assigned to your router. Requests going to IP address #1 would get forwarded to the .198 address, and requests going to IP address #2 would be forwarded to the .199 address.
This is interesting, I’m able to connect via the ftp to the correct folder through ftp.domain.tld… Shouldn’t this be an issue as well if the router were the problem?
Edit: Actually, it would know because of the username…
As per private discussion with Eric, we determined that I couldn’t have SSL on a second website without a second external IP anyways.
So, I purchased an CISCO SD2008 8-Port switch and connected by Debian box directly to it with a single NIC. Within my interfaces file I have added the ip-alias as eth0:0 and made sure that everything else in the file is correct.
Finally, I updated all of my apache configuration files to reflect the secondary ip.
The issue I am having now, and for which eric is also unable to find a solution, is that I cannot ping the box on the eth0:0 IP.
Is there something wrong with my setup? Do I need to have a second NIC and use two ports on the switch rather than one???