VHOST: unable to show vhost page

Hi all,

I’m a fresh webmin+virtualmin user and i would say above all thanks for your work, I’m a developer, I’ve a very poor knowledge of topics such as system administration but I set up a web server in 30 minutes and saved me a lot of time.

Here the problem I have, it’s about vhost:

  • I’ve a vps with debian 6, I’ve installed virtualmin using install.sh script
  • If i type http://IP i see the apache “It works” page
  • I created the vhost fraz.org , I’ve changed nothing, I left default values everywere
  • I pointed the A record to my vps IP
  • If i type http://fraz.org i see the same “It works” page instead the custom page (/home/fraz/public_html/index.html)

So, I read a lot of post in this forum, like this (https://www.virtualmin.com/node/22726) and various documentation (https://www.virtualmin.com/documentation/web/troubleshooting) but i can’t figure how resolve.

Below i add some addtional (useful ?) info:

  • virtualmin network configuration (attached)
  • virtualmin rechecklog (attached)

What i’ve done:
I’ve checked my network configuration (attached)

  • I suppose my internal IP address is 127.0.0.2
  • I checked all vhost config file:
cat /etc/apache2/sites-enabled/fraz.org.conf SuexecUserGroup "#1000" "#1000" ServerName fraz.org ServerAlias www.fraz.org ServerAlias webmail.fraz.org ServerAlias admin.fraz.org DocumentRoot /home/fraz/public_html ... cat /etc/apache2/sites-enabled/000-default ServerAdmin webmaster@localhost DocumentRoot /var/www ...

I changed 000-default file to

<VirtualHost 127.0.0.2:80>

but when i restart apache:

/etc/init.d/apache2 restart
Restarting web server: apache2[Tue Oct 16 12:53:36 2012] [error] (EAI 2)Name or service not known: Failed to resolve server name for 127.0.0.2 (check DNS) – or specify an explicit ServerName
… waiting [Tue Oct 16 12:53:37 2012] [error] (EAI 2)Name or service not known: Failed to resolve server name for 127.0.0.2 (check DNS) – or specify an explicit ServerName

so I edited again the default config file:


I receive no error when i restart the server but http://fraz.org shows the default site.

I 'm very confused, please, can Anyone point me in the right direction?

Thanks a lot

Howdy,

You really don’t need the config “/etc/apache2/sites-enabled/000-default” at all. It’s for a default VirtualHost that you aren’t using, and appears to just be getting in the way.

you could just remove that file with:

rm /etc/apache2/sites-enabled/000-default

And then restart Apache.

As far as the IP address to use in the VirtualHost sections of your config – you’d want to use the primary IP address of your machine for that.

If you run “ifconfig”, your primary IP address is usually the IP that shows up under “eth0”.

-Eric

Hi Eric,

thanks for your quick reply.

I deleted the default file and edited the vhost configuration, I’ve restarted apache and everything worked fine. Now i’m going to create other vhost but i’m a bit confused:

ifconfig has no eth interface, so i used in the configuration file the public server ip address. Can this be an issue?

lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1117 errors:0 dropped:0 overruns:0 frame:0 TX packets:1117 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:97401 (95.1 KiB) TX bytes:97401 (95.1 KiB)

venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255
inet6 addr: 2001:41d0:51:1::3436/128 Scope:Global
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:8036 errors:0 dropped:0 overruns:0 frame:0
TX packets:7577 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1082759 (1.0 MiB) TX bytes:1745750 (1.6 MiB)

venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:MY.PUBLIC.IP.ADDRESS P-t-P:MY.PUBLIC.IP.ADDRESS Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1

Thanks again.

F

Ah, you’ve got an OpenVZ-based VPS there… so you’d want to use the IP specified in your venet0:0 interface, which should be your public IP.

Also, I’d suggest going into System Settings -> Virtualmin Config -> Network Settings, and make sure that “Network interface for virtual addresses” is set to “venet0:0”.

-Eric