How do i install apache on my ubuntu 12.04 where it has virtualhost
        Posted  
        
            by 
                YumYumYum
            
        on Super User
        
        See other posts from Super User
        
            or by YumYumYum
        
        
        
        Published on 2012-09-13T08:10:41Z
        Indexed on 
            2012/09/13
            9:40 UTC
        
        
        Read the original article
        Hit count: 355
        
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
$ /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?
© Super User or respective owner