I followed this guide: How To Setup an Ubuntu LAMP Server for Development Purposes Only
But I've run into a problem. The Server I setup is on a VM (VirtualBox). I did this so I wouldn't have to manage it on my local machine and I could easily turn it on/off when needed. I used 64bit Ubuntu 9.04 Server. I gave the VM it's own Static IP address (192.168.1.105) and HostName (LAMPVM) via my Routers config.
The problem I've run into is when I try and access my virtual hosts from my HARDmachine (not the VM), it doesn't work...
I have my /etc/apache2/httpd.conf setup as follows:
<Directory "/home/USER/workspace">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
NameVirtualHost *
ServerName localhostI have the following sites-enabled:
localhost:
<VirtualHost *>
ServerName localhost
ServerAlias localhost *.localhost
VirtualDocumentRoot /home/USER/workspace/%1/
</VirtualHost>test1:
<VirtualHost *>
ServerName test1
ServerAlias test1 *.test1
DocumentRoot /home/USER/workspace/test1/
</VirtualHost>test2:
<VirtualHost *>
ServerName test2
ServerAlias test2 *.test2
DocumentRoot /home/USER/workspace/test2/
</VirtualHost>And I enter "LAMPVM" into my browser it only goes to the most recent domain I added (test2).
If I enter "test1.LAMPVM" into my browser it doesn't find the address.
I realize this is because my DNS on my HARDmachine (not the VM) is not configured to recognize what "test1.LAMPVM" means. But when I enter the following into my /etc/hosts file of my HARDmachine:
127.0.0.1 localhost
127.0.1.1 my-machine
#LAMPVM
192.168.1.105 test1.lampvm
192.168.1.105 test2.lampvmBy browser goes to the address "test2.lampvm", but it thinks "test1.lampvm" is the same as "test2.lampvm" (or "test1.lampvm" is being routed to the most recently added domain [which happens to be test2]).
Again, I kinda get why this isn't working because both "test1.lampvm" and "test2.lampvm" are pointing to the same address (192.168.1.105), but that is the address of the VM, and I don't know how else to get access to multiple domains on the same VM/IP?
My guess is I probably need to make some adjustments in my Router, but not sure exactly what?
Also in a possibly related note I get some warnings when reloading Apache:
sudo /etc/init.d/apache2 reload
* Reloading web server config apache2 [Tue Oct 06 11:20:22 2009] [warn] The Alias directive in /etc/apache2/conf.d/phpmyadmin.conf at line 3 will probably never match because it overlaps an earlier Alias.
[Tue Oct 06 11:20:22 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
[ OK ]I noticed that someone else was also getting these warnings but there was no reply there?
Any/All Help, Comments, Suggestions will be greatly appreciated.
-Chris

Comments
Does it work from on the vm
Does it work from on the vm properly? If not, then what is happening?
Did you edit the file mentioned in there error? You weren't supposed to.
Best Orange County barbers
Not working from VM, and did not modify phpmyadmin
I didn't test it from the VM because the VM only has terminal SSH access (NO GUI). But I did install curl and test it by running:
curl http://lampvmAnd sure enough test2's index.html loaded up
So I tried
curl http://test1.lampvmand I got "404 Not Found" :(
Same thing goes for
curl http://test2.lampvmAs for the /etc/apache2/conf.d/phpmyadmin.conf file, NO I never touched it, which makes me wounder why it's throwing an error all of the sudden.
Also as an update, I posted a duplicate thread on Ubuntu's Fourms and it looks like they don't like the fact that I modified the /etc/apache2/httpd.conf file, and said that the modifications I made to that file should have been made in /etc/apache2/ports.conf. Any idea's on that?
Here's a link to the Ubuntu Forums Post: http://ubuntuforums.org/showthread.php?t=1284151
That would certainly be true
That would certainly be true if you were running a live site. If you are just running locally I don't think it would really matter much. You can change to what they suggested if you like.
Usually the 404 means that the directory you have put your site in has insufficient permissions. You need to chmod it most likely.
cd /to/your/workspacels -l
and look at the permissions.
Best Orange County barbers
Ok, I'll leave the settings
Ok, I'll leave the settings as is then.
Both directories (test1 & test2) inside /home/USER/workspace are chmod 777
Do I don't think that's the problem.
/etc/hosts
I'm no Apache expert, but I would try this in /etc/hosts:
127.0.0.1 localhost
127.0.1.1 my-machine
192.168.1.105 test1.lampvm test2.lampvm
OK I added it as you
OK I added it as you mentioned, but now both "http://test1.lampvm" and "http://test2.lampvm" point to the test2 site (or /home/USER/workspace/test2)
/etc/apache2/httpd.conf
Try this;
Get rid of this:
Take the trailing slash off your document root statements in the two remaining virtual hosts
I think they should look like this:
DocumentRoot /home/USER/workspace/test1
DocumentRoot /home/USER/workspace/test2
[SOLVED]
I was trying to use http://test1.lampvm & http://test2.lampvm
But now I've changed my /etc/hosts file like so,
on the VM
127.0.0.1 localhost127.0.0.1 test1
127.0.0.1 test2
on the HARDmachine
127.0.0.1 localhost
127.0.1.1 my-machine
#LAMPVM
192.168.1.105 test1 test2
And now when I navigate to http://test1 & http://test2, IT WORKS !!! :-D
Thanks for all the help everyone !
complete tutorial for Ubuntu 10.10
There is a complete tutorial on setting up LAMP server, enabling mod_rewrite and VirtualHosts is available at
http://amritbera.blogspot.com/2010/11/ubuntu-1010-lamp-installation-apac...
Thanks