Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

At home I have an Ubuntu 10.10 desktop system for development purpose. For some reason I can't get virtual hosting working. At work I have an almost similar setup (completely done by me) with Apache and vhost working.

  • Hosts: I've added the local domainname to the hosts file, and that seems to work. I see the default host page.
  • Below you see the modules I've enabled, plus the enabled sites.
  • I have restarted Apache

I'm lost at what I'm missing here to get this working.


* apache.conf *

Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

* mods-enabled *

lrwxrwxrwx 1 root root   28 2009-07-28 23:20 alias.conf -> ../mods-available/alias.conf
lrwxrwxrwx 1 root root   28 2009-07-28 23:20 alias.load -> ../mods-available/alias.load
lrwxrwxrwx 1 root root   33 2009-07-28 23:20 auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root root   33 2009-07-28 23:20 authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root root   36 2009-07-28 23:20 authz_default.load -> ../mods-available/authz_default.load
lrwxrwxrwx 1 root root   38 2009-07-28 23:20 authz_groupfile.load -> ../mods-available/authz_groupfile.load
lrwxrwxrwx 1 root root   33 2009-07-28 23:20 authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx 1 root root   33 2009-07-28 23:20 authz_user.load -> ../mods-available/authz_user.load
lrwxrwxrwx 1 root root   32 2009-07-28 23:20 autoindex.conf -> ../mods-available/autoindex.conf
lrwxrwxrwx 1 root root   32 2009-07-28 23:20 autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx 1 root root   26 2009-07-28 23:20 cgi.load -> ../mods-available/cgi.load
lrwxrwxrwx 1 root root   30 2009-07-28 23:20 deflate.conf -> ../mods-available/deflate.conf
lrwxrwxrwx 1 root root   30 2009-07-28 23:20 deflate.load -> ../mods-available/deflate.load
lrwxrwxrwx 1 root root   26 2009-07-28 23:20 dir.conf -> ../mods-available/dir.conf
lrwxrwxrwx 1 root root   26 2009-07-28 23:20 dir.load -> ../mods-available/dir.load
lrwxrwxrwx 1 root root   26 2009-07-28 23:20 env.load -> ../mods-available/env.load
lrwxrwxrwx 1 root root   27 2009-07-28 23:20 mime.conf -> ../mods-available/mime.conf
lrwxrwxrwx 1 root root   27 2009-07-28 23:20 mime.load -> ../mods-available/mime.load
lrwxrwxrwx 1 root root   34 2009-07-28 23:20 negotiation.conf -> ../mods-available/negotiation.conf
lrwxrwxrwx 1 root root   34 2009-07-28 23:20 negotiation.load -> ../mods-available/negotiation.load
lrwxrwxrwx 1 root root   27 2009-07-28 23:20 php5.conf -> ../mods-available/php5.conf
lrwxrwxrwx 1 root root   27 2009-07-28 23:20 php5.load -> ../mods-available/php5.load
lrwxrwxrwx 1 root root   33 2010-05-26 21:49 reqtimeout.conf -> ../mods-available/reqtimeout.conf
lrwxrwxrwx 1 root root   33 2010-05-26 21:49 reqtimeout.load -> ../mods-available/reqtimeout.load
lrwxrwxrwx 1 root root   31 2009-07-28 23:20 setenvif.conf -> ../mods-available/setenvif.conf
lrwxrwxrwx 1 root root   31 2009-07-28 23:20 setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx 1 root root   29 2009-07-28 23:20 status.conf -> ../mods-available/status.conf
lrwxrwxrwx 1 root root   29 2009-07-28 23:20 status.load -> ../mods-available/status.load
lrwxrwxrwx 1 root root   34 2010-11-25 11:12 vhost_alias.load -> ../mods-available/vhost_alias.load

* sites-enabled *

lrwxrwxrwx 1 root root   26 2009-07-28 23:20 000-default -> ../sites-available/default
lrwxrwxrwx 1 root root   32 2010-11-13 22:03 test.local -> ../sites-available/test.local

* messages *

Nov 25 15:10:56 ubuntu-rxt kernel: [234402.009386] [UFW BLOCK] IN=eth0 OUT= MAC=00:0e:2e:b8:72:59:00:24:fe:d4:bc:02:08:00 SRC=192.168.178.1 DST=192.168.178.26 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=14809 DF PROTO=TCP SPT=4913 DPT=14013 WINDOW=5840 RES=0x00 SYN URGP=0

* error.log *

[Thu Nov 25 15:13:57 2010] [notice] caught SIGTERM, shutting down
[Thu Nov 25 15:13:58 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4 with Suhosin-Patch configured -- resuming normal operations

* access.log *

127.0.0.1 - - [25/Nov/2010:15:15:24 +0100] "GET / HTTP/1.1" 304 211 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3"

* hosts *

127.0.0.1   localhost test.local
127.0.1.1   ubuntu-rxt

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

* test.local *

<VirtualHost *:80>
DocumentRoot /var/www-vhosts/test.local
<Directory /var/www-vhosts/test.local/>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>
</VirtualHost>

* default *

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>
share|improve this question
    
Please post as much as you can of 000-default and test.local. Also, check /var/log/apache/error.log or /var/log/messages for error messages from apache. –  Lethargy Nov 25 '10 at 13:48
    
I've added error.log, messages, access.log, hosts, test.local and default to the original question. The default host is called "default", not "000-default". –  SPRBRN Nov 25 '10 at 14:59
    
Sorry - in sites-available it's called "default", the symlink from sites-enabled is called "000-default". –  SPRBRN Nov 25 '10 at 15:02
add comment

1 Answer

up vote 2 down vote accepted

Don't you need ServerName/ServerAlias for the sites? Take a look here:

share|improve this answer
    
Thanks! That was the problem. –  SPRBRN Nov 25 '10 at 19:24
    
You are welcome, glad it's solved! –  icyrock.com Nov 25 '10 at 19:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.