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

According to the docs https://help.ubuntu.com/10.04/serverguide/httpd.html i have done following, and that is almost how i do always in my Fedora, but Ubuntu looks like its not working.

a) DNS to IP

$ echo "127.0.0.1  a" > /etc/hosts
$ echo "127.0.0.1  b" > /etc/hosts

b) Apache virtualhost

$ ls
1  2  default  default.backup  default-ssl
$ cat 1
<VirtualHost *:80>
 ServerName a
 ServerAlias a
 DocumentRoot /var/www/html/a/public
 <Directory /var/www/html/a/public>
    #AddDefaultCharset utf-8
    DirectoryIndex index.php
    AllowOverride All
    Order allow,deny
    Allow from all
 </Directory>
</VirtualHost>

$ cat 2
<VirtualHost *:80>
 ServerName b
 ServerAlias b
 DocumentRoot /var/www/html/b/public
 <Directory /var/www/html/b/public>
    #AddDefaultCharset utf-8
    DirectoryIndex index.php
    AllowOverride All
    Order allow,deny
    Allow from all
 </Directory>
</VirtualHost>

c) load into Apache and restart the service

$ a2ensite 1
$ a2ensite 2
$ a2dissite default
$ a2enmod rewrite
$ /etc/init.d/apache2 restart

d) Browse the new 2 hosts

$ firefox http://a

Does not work it goes always with http://a or http://b to /var/www/html

How do i fix it so that it goes to its own directory e.g: http://a goes to /var/www/html/a/public not /var/www/html?

share|improve this question
    
Apache should work the same on any operating system its placed on. The only difference is how you configure it on a given system. Can be make this less localized to Ubuntu considering Fedora is also a Linux kernel the directions literally should be the same. – Ramhound Sep 13 '12 at 11:42
up vote 1 down vote accepted

A good way to find out what apache thinks it is doing is to run

apachectl -S

This will tell you all the configured virtual hosts and where they are defined. Perhaps that will help track down your issue?

share|improve this answer

You must log in to answer this question.

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