1828017 Members
1866 Online
109973 Solutions
New Discussion

Apache + Vhosts

 
SOLVED
Go to solution
Piotr Kirklewski
Super Advisor

Apache + Vhosts

Hi there I did:

vim /etc/apache2/sites-available/default

NameVirtualHost *

ServerName domain.com
DocumentRoot /home/www/default/


mkdir /home/www/default

vim /home/www/default/index.html

/etc/init.d/apache2 force-reload

mkdir /home/pkirklewski.com

vim /home/pkirklewski.com/index.html #some text inside

vim /etc/apache2/sites-available/pkirklewski.com

root@rails:/home/www# vim /etc/apache2/sites-available/pkirklewski.com

ServerAdmin webmaster@pkirklewski.com
DocumentRoot /home/www/pkirklewski.com
ServerName pkirklewski.com
ServerAlias www.example.com


a2ensite /etc/apache2/sites-available/pkirklewski.com /etc/apache2/sites-enabled/pkirklewski.com

At this point I'm getting error:

This site does not exist!

What am I doing wrong ?

Cheers

Jesus is the King
4 REPLIES 4
Stuart Browne
Honored Contributor
Solution

Re: Apache + Vhosts

And what was the error you got in the 'error_log' ?
One long-haired git at your service...
Piotr Kirklewski
Super Advisor

Re: Apache + Vhosts


root@rails:/etc/apache2# tail -f /var/log/apache2/error.log

[Mon Jul 30 17:07:05 2007] [notice] caught SIGTERM, shutting down
[Mon Jul 30 17:07:06 2007] [notice] Apache/2.0.55 (Ubuntu) configured -- resuming normal operations
[Mon Jul 30 17:07:44 2007] [notice] caught SIGTERM, shutting down
[Mon Jul 30 17:07:45 2007] [notice] Apache/2.0.55 (Ubuntu) configured -- resuming normal operations
[Mon Jul 30 17:13:39 2007] [error] [client 192.168.168.66] File does not exist: /home/www/default/favicon.ico
[Mon Jul 30 17:13:39 2007] [error] [client 192.168.168.66] File does not exist: /home/www/default/favicon.ico
[Mon Jul 30 17:23:15 2007] [notice] caught SIGTERM, shutting down
[Mon Jul 30 17:23:16 2007] [notice] Apache/2.0.55 (Ubuntu) configured -- resuming normal operations
[Mon Jul 30 17:25:15 2007] [notice] caught SIGTERM, shutting down
[Mon Jul 30 17:25:16 2007] [notice] Apache/2.0.55 (Ubuntu) configured -- resuming normal operations
[Tue Jul 31 08:22:09 2007] [notice] caught SIGTERM, shutting down
[Tue Jul 31 08:22:10 2007] [notice] Apache/2.0.55 (Ubuntu) configured -- resuming normal operations



root@rails:~# apache2ctl -t -D DUMP_VHOSTS


VirtualHost configuration:
192.168.168.249:80 pkirklewski.com (/etc/apache2/sites-enabled/pkirklewski.com:1)
wildcard NameVirtualHosts and _default_ servers:
*:* is a NameVirtualHost
default server pkirklewski.com (/etc/apache2/sites-enabled/000-default:2)
port * namevhost pkirklewski.com (/etc/apache2/sites-enabled/000-default:2)
Syntax OK
Jesus is the King
Stuart Browne
Honored Contributor

Re: Apache + Vhosts

I really dislike the debian style of vhost configuration.. Always drives me batty.

Anyway, it seems as if you're running a NameVirtualHost server, and using an IP defined as the VirtualHost.

Change the 192.168.168.249:80 to *:80, and see how that responds.

Also, double check the permissions on /home/pkirklewski.com/ and it's files.
One long-haired git at your service...
Piotr Kirklewski
Super Advisor

Re: Apache + Vhosts

This is the way in Ubuntu:

/sbin/ifconfig eth0:0 192.168.168.248
/sbin/ifconfig eth0:1 192.168.168.249

vim /etc/apache2/sites-available/aaa.com


ServerName www.aaa.com
ServerAlias aaa.com
DocumentRoot /var/www/html/aaa.com/html
ErrorLog /var/log/apache2/www.anothercompany.com-error_log
CustomLog /var/log/apache2/www.anothercompany.com-access_log common


/etc/init.d/apache2 stop
/etc/init.d/apache2 start

EEDIT /etc/hosts and add 192.168.168.248 aaa.com


vim /etc/apache2/sites-available/bbb.com


ServerName www.bbb.com
ServerAlias bbb.com
DocumentRoot /var/www/html/bbb.com/html


/etc/init.d/apache2 stop
/etc/init.d/apache2 start

EEDIT /etc/hosts and add 192.168.168.248 bbb.com
Jesus is the King