I am installing Virtualmin as an internal server and I believe as a result I am experiencing many difficulties since it is not bound to any real domain name. (I am assuming this is the cause of a great deal of headaches)
I’ve given my server a host name: [hostname].com. On this computer on the network I’ve modified the hostfile to the [ip-address] of the server and the [hostname].com. This works fine.
The problem is any virtual servers have a name appended to them like: fossil.[hostname].com.
Obviously I cannot put ports inside my hostfile. Is the server capable of identifying that the incoming request is for the subserver fossil.hostname.com and redirect it to the appropriate port.
(I am separating each subserver on different ports in order to access each one of them individually since they share the same ip)
So in my hostfile on this computer I put fossil.hostname associated with the same ip since i cannot specify a port.
Is there any work around to make this work? Hopefully without giving the server individual ip addresses.
We have a production site not set up by myself and it has many sites which share the same ip but their domainname points to the right site, so I don’t understand why this doesn’t work automatically??
What ports exactly are you referring to? Virtualmin itself does not do any port management, if you e.g. want each website to be reached on another port, you have to manually edit the Apache config, and add the port number to the URL in the web browser.
And this does not cover email. It is not possible to use another port than 25 for mail coming in from the Internet.
The other thing you described is called “name-based virtual hosting” in Apache and is the usual way to do it. Apache can serve many sites on the same IP and distinguishes them via the hostname which is transmitted in the http request.
Thank you Locutus of borg =D for all your helpful hints, now I can go look up “name-based virtual hosting” in the docs, seems pretty simple, just add server Aliases right? If so then I am heading the right direction.
I thought this was also causing me some CGI error but I managed to fix that.
What was confusing me was that you can specify a port in Virtualmin do I don’t understand when you say that Virtualmin itself does not do any port management. I assume this means that whatever the virtual server is named won’t be automatically tied to that port?? No, that doesn’t sound right… Take a look here on the Virtualmin Control panel
well… I would tell you the steps but now I can’t seem to access :10000 It was fine yesterday, WTH!!!
You shall be assimilated… and stuff.
Well, of course you can instruct Apache to serve a website on a certain port aside from the default 80/443, and you can use Virtualmin to configure those ports. That’d be “port-based virtual hosting”. But that would require that you enter the port number in your client browser’s URL bar, which is probably not what you were aiming at.
Your first post sounded like you wanted subdomains of your parent domain to automatically be “forwarded” to a certain port. I’m just guessing that you mean Apache port here. You cannot “forward a hostname to a port”, since, as you correctly noticed, there is no such thing as hostname/port mapping in DNS, neither in your hosts file nor in actual nameservers.
So, what you’d have to do to accomplish what you were implying is use some kind of port forwarding in a router that listens to multiple IP addresses, and each of those gets assigned one of your hostnames. Then you can forward connects to the router, on port 80, to your server on different ports. And Virtualmin does not configure routers or port forwardings in that manner, that’s why I said “Virtualmin does not do port management”.
But I don’t think this whole smash is what you’re aiming at. So, just use name-based virtual hosting. You don’t add “alias servers”, but each parent or sub server you add is served by your Apache on the same IP and port, and the hostname in the HTTP request tells Apache which files to serve.