apache2 virtual host problem

12 posts / 0 new
Last post
#1 Mon, 10/07/2013 - 14:46
Hans

apache2 virtual host problem

Hiya,

I am using virtualmin since a lil eternity and really love your product. I used it on many, many servers and it always worked instantly without any issues. Thank you at that point for the great work, Jamie! :)

Now a client got a VPS from server mania dot com, w. a phresh Debian 7.

We put a lil default website in /var/www/ Website is accessible via IP and all domain names, that point to the VPS's IP.

Then we installed virtualmin w. webmin using the install .sh.

Next we set up 2 lil virtualhosts w. virtualmin - they live in like /home/somename and /home/yetanothername Now when we access any of the sites or the IP, the browser shows the contents of the last virtual host we just set up (last, alphabetically and timely). The default page in var/www is gone too (=showing the last virtual host).

We played around w. NameVirtualhost statements in /etc/apache2/apache2.conf and IPs in webmin/networking/Network configuration/ but the behavior of apache didn't change.

We compared the setup on this server to other virtualmin installations and could not see any difference in settings, that could cause the difference in behaviors.

Is it possible that the fact that we tired nginx for a moment but disabled it and went back to apache messed something up that could cause the described problem? Or the fact that the VPS has 2 "real" IPs (IPv4)?

Please help us spot the bits&bytes that cause this erratic behavior. Thanks again :)

H.

Mon, 10/07/2013 - 15:33
ahwm

I have a similar issue... On my old Slackware server running Webmin, I was able to set up virtual hosts no problem. But now that I'm trying to use Virtualmin on CentOS 6.4 x86_64 (on AWS EC2, if that helps) I've assigned an EIP but when trying to access to the domain, it simply shows the content from /var/www/html instead of from /home/user/public_html.

Any ideas?

Mon, 10/07/2013 - 16:34
Locutus

Virtualmin configures the system (and contains modified packages) to serve webpage only from /home/DOMAIN. It is suggested to not change that behavior, and put everything you wish to serve to the web in a virtual server in /home, and not use /var/www or similar.

It is also suggested to use ONLY the installer script to install Virtualmin and all related software (Apache, PHP, MySQL, etc. etc.) and not install anything manually beforehand.

To configure which website is shown when e.g. the IP of the server is entered in the browser, you need to define that virtual server as "Default for the server's IP" in Server Configuration -> Website Options.

@ahwm: Your issue sounds rather different to the one the OP had, since your system is showing the opposite behavior. Eric might be able to say more about CentOS.

Mon, 10/07/2013 - 16:55 (Reply to #3)
ahwm

This seemed closer than others that were recent. And it is similar in that only one website will display.

Mon, 10/07/2013 - 17:06
Locutus

Okay, after reading through your posts again, I get the feeling that both your problems arise because you had Apache with active sites installed before using the Virtualmin installer. That is highly discouraged, since as I said Virtualmin has specially modified packages that serve from /home. That and its attempts to configure Apache will quite likely clash with existing Apache setups.

Mon, 10/07/2013 - 17:25
ahwm

This was a new set up and I don't think that Apache was already installed. Though I have been wrong before. At least I never did any configuring if it was installed already.

If an update was installed, would that cause some headache? I'm pretty sure I only installed updates through the virtualmin interface.

I'll try spinning up another with CentOS and see if Apache is pre-installed on it. If that were the case, I should be able to remove Apache and then install Virtualmin, right?

Tue, 10/08/2013 - 03:39
Locutus

@ahwm: You should make sure that during installation, you don't select any packages or collections that sound like they install hosting stuff. I'm assuming that CentOS has some kind of package selection during installation. :) Install ONLY the basic stuff and an SSH server, and let the installer script do all the rest.

Tue, 10/08/2013 - 09:37
ahwm

It's an Amazon EC2 with a CentOS 6.4 AMI, so I have no control over how it's installed.

That being said, I created a new instance and started from scratch and it worked fine (until I stopped it, that is). So my guess is that a package upgrade somewhere along the line broke something. But at least I had it working. That was my primary concern.

Tue, 10/08/2013 - 09:48
Locutus

Okay, if you have no control over whether some kind of Apache packages get pre-installed, you'll need Eric's help who can probably tell you how to get rid of them on CentOS. I'm a Debian/Ubuntu user with little experience on CentOS. :)

Tue, 10/08/2013 - 11:52
andreychek

Howdy,

Hmm, Virtualmin should work on EC2 with CentOS.

However, you could certainly try removing Apache after spinning up your instance, if that's the issue you're having... you can do that with this command on CentOS:

rpm -e httpd

Tue, 10/08/2013 - 14:22
Hans

We never had any issues with e.g. Apache having been there already and/or some index.html sitting in /var/www/ before virtualmin was installed. Neither have we experienced any issues w. updates - we usually even let the systems update themselves automatically. That never affected virtualmin in any way. Unlike e.g. Plesk, virtualmin is pretty "tolerant" and never got messed up by system updates, as it uses the same mechanisms, i.e. yum, apt-get, aptitude.

Also the location /home/domain is not mandatory - it can freely be chosen in virtualmin settings :)

Yes, we also suspected the servers IP and tried changing it via virtualmin, but that didn't work out directly: we got "Default IP address for virtual servers is 127.0.0.2. Default IP address is set to 127.0.0.2, but the detected external address is actually [real IP here] This is typically the result of being behind a NAT firewall, and should be corrected on the module configuration page."

And when we changed the IP Address from 127. to the real one in virtualmin->"Change IP Addresses", we got "No non private IP servers are using the old IP address" and the 127. remained as the default one. It basically didn't let us change the default IP from the 127. to the real one. This seemed strange so we kept looking until we found another setting for the IP in virtualmins very own Module Config: We unchecked "Default virtual server IP address form network interface" and entered the real IP.

Now it works! :)

But we have the IP hardcoded in all .conf files for all sites in /etc/apache2/sites-available/ I personally don't fancy IP based virtual hosting, but prefer a purely name based solution. Maybe we will check that on the next occasion - most of our other virtualmin installations do not have the IP in the .conf files, because it is a pain in case servers move or get new IPs.

Cheers, H.

Tue, 10/08/2013 - 14:33
Locutus

"/home/domain" is not mandatory as such, but something under "/home" is mandatory, at least if you intend to use FCGId/suexec. Virtualmin contains a modified version of that which only executes web scripts from folders under "/home".

Topic locked