Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm pretty close to doing what I want, but alas, the solution to the final hurdle eludes me. Essentially I'm trying to get to a position where I can host multiple sites on one vb and access them using a simple url from either machine...

My setup:

Windows 7 host which contains an entry in hosts file which reads: I have a DHCP reservation for this address, which reserves it for my virtualbox's unique mac address

Virtualbox is set up with a bridged network adapter and promiscuous mode: allow all (not sure if this is necessary) I have made no changes to the hosts file on guest os.

I have created a new file named at /etc/apache2/sites-available called and edited it as follows:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName *
    DocumentRoot /var/www/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

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

    ErrorLog ${APACHE_LOG_DIR}/laravel_error.log

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

    CustomLog ${APACHE_LOG_DIR}/laravel_access.log combined

I have then enabled it (I thought) by typing sudo a2ensite and restarting apache

Current Situation:

So at the moment I can access by web root (/var/www/) from the host by typing in my address bar and I can access it from my guests browser by typing localhost

I can access my projects index file (/var/www/ from the host by typing in my address bar and I can access it from my guests browser by typing localhost/

What I want

This is OK but what I would like is to be able to access the root of my site (/var/www/ by simply typing in the address bar of either machine - Can anyone explain what I'm doing wrong here. I would be eternally grateful.

Additional info requested:

result of ls -l in /etc/apache2/sites-enabled/

total 0
lrwxrwxrwx 1 root root 26 Feb 26 17:16 000-default -> ../sites-available/default
lrwxrwxrwx 1 root root 30 Feb 26 18:27 -> ../sites-available/

...happy to provide any other info which may help solve this.

Also, other than install the lamp stack. I really haven't done anything other than what is listed here - if I haven't mentioned I probably haven't done it so ANY suggestions are appreciated. Safe to assume your dealing with a linux noob... no offense will be taken.

share|improve this question
Are you also hosting your own DNS? – hydroparadise Feb 26 '13 at 22:19
no I'm not. should I be? – WebweaverD Feb 26 '13 at 22:40
up vote 1 down vote accepted

I doubt the problem is a DNS problem, although I do question if the file you have made is actually being read by Apache - the line "DocumentRoot /var/www/" should be enough to get that working.

[ Indeed if this is all you are trying to do, do you need the other guff you have put in ? If not, I'd try removing this file and modifying the DocumentRoot in the main apache config ].

If this does not solve your problem, can you provide the result of "ls -l /etc/apache2/sites-enabled" as there should be a symlink in there to sites-available/ which may be missing - if not, we might need to find out if this file is being parsed, and if not, why not.

share|improve this answer
Thanks for your suggestions. I didn't make that file, it was copied from the default and edited, I'm afraid I dont know enough about what I'm doing to "strip out any guff" so I only edited what seemed like it needed changing. I have updated my question with the results of ls -l. NOTE: Although I only have one site at the moment I want to get multiple sites on the same vm, until now I have been creating a separate vm for each site but it's surprising how quickly a terabyte can disappear that way. Presumably if I modify the document root in the apache config it will be a one site setup. – WebweaverD Feb 26 '13 at 23:06
Also on the other guff point. It would be useful if I could separate out my error logs (and ideally mysql logs but I'll worry about that later) access logs could probably go but the closer I can emulate the type of system it will go live on the better. Also quite keen to learn how to do things properly (whichever way that may be) and start getting my head around lamp admin a bit better – WebweaverD Feb 26 '13 at 23:11
From a speed and resource point of view, you are orders of magnitude better setting up virtual hosts then virtual machines for each site, and its actually not that hard to do with Apache. Do you want to have a chat and we can try and solve your problem step by step ? I'm arround for the next hour or so (but never used chat !!!) – davidgo Feb 27 '13 at 1:11
Unfortunately I was a good 20 hours late checking back. But I would really appreciate your help if you have the time. I will be at my pc most of tomorrow and friday so hopefully our paths will cross at some point. If you could drop a comment here when your online and have a little time to spare I would be grateful - I'll keep an eye out for an alert. Thanks in advance for your help. – WebweaverD Feb 27 '13 at 21:43
Shall we meet to chat at 2:00am GMT (ie 2.5 hours from now) ? – davidgo Feb 27 '13 at 23:32

You could try the tutorial I found here. Seems to give a run down on how to get setup using vhosts on Ubuntu. It also covers Arch Linux as well. But I was able to find out what my issue was after reading the tutorial, I was missing a simple step before following it. Possibly you are running into the same situation.

Also possibly an Alias section would solve your issue with how to type in what you want and not have to include the localhost portion.

share|improve this answer
You seem to only be posting answers referencing one particular blog. If this is your site or you are a contributor then you must disclose any affiliation otherwise your posts will be marked as spam and deleted by the community – Mokubai Sep 8 '13 at 20:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .