Announcement

Collapse
No announcement yet.

Apache-LAMP-virtual hosts

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Apache-LAMP-virtual hosts

    I'm confused about virtual hosts in apache. I've installed LAMP per instructions here https://help.ubuntu.com/community/ApacheMySQLPHP. I've installed webmin and it works fine. I've set up two test e-commerce sites that are working well. I've changed the directories to /home/user/public_html/site1&2 and enabled the sites with the a2ensite command.

    1.Is this a2ensite command only in (k)ubuntu or is it standard in apache2?

    2. Is the a2ensite command supposed to take the place of editing the httpd.conf file?
    (My sites show 404 not found if I don't add virtual hosts to httpd.conf although I get errors when restarting apache) Here is my httpd.conf.
    Code:
    ServerName localhost
    
    NameVirtualHost 127.0.0.1:80
    
    <VirtualHost 127.0.0.2:80>
    ServerName [url]http://www.site1.com[/url]
    DocumentRoot /home/user/public_html/site1
    </VirtualHost>
    
    <VirtualHost 127.0.0.3:80>
    ServerName [url]http://www.site2.com[/url]
    DocumentRoot /home/user/public_html/site
    </VirtualHost>
    I can't get the sites to work if I use *:80 or 127.0.0.1:80 for both sites therefore the 127.0.0.2&.3 This seems wrong from my reading of the apache2 docs but I can't get it to work otherwise.

    I can't get myphpadmin working and I'm trying to install joomla but I don't know where to put the joomla folder for apache to access it. I know /var/www is the standard directory for apache. I tried to a2ensite the joomla without success.

    Anyone have any helpful insights?
    Thx.


    #2
    Re: Apache-LAMP-virtual hosts

    i don't know about the tools you mention.
    but...speaking of apache2...

    you should have:

    a) a directory named /etc/apache2/sites-available containing a file per virtual host
    in my case, i have...
    root# ls -l /etc/apache2/sites-available/
    total 8
    -rw-r--r-- 1 root root 1225 2007-12-21 12:28 ale
    -rw-r--r-- 1 root root 1231 2007-12-21 12:26 crisps
    b) a directory named /etc/apache2/sites-enabled/ that links the (enabled) available sites
    again, in my case it's...
    root# ls -l /etc/apache2/sites-enabled/
    total 0
    lrwxrwxrwx 1 root root 35 2007-12-21 12:07 000-crisps -> /etc/apache2/sites-available/crisps
    lrwxrwxrwx 1 root root 32 2007-12-21 12:07 001-ale -> /etc/apache2/sites-available/ale
    c) the files in /etc/apache2/sites-available (one per virtual host) shoud include the necessary configuration
    the following is an example for my ale and crisps
    NameVirtualHost 127.0.1.1
    <VirtualHost 127.0.1.1>
    ServerName www.ale.ch
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/ale
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    ...
    NameVirtualHost 127.0.1.2
    <VirtualHost 127.0.1.2>
    ServerName www.crisps.ch
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/crisps
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    ...
    d) the necessary mapping in /etc/hosts (since my names are not registered in the dns, ...)
    127.0.0.1 localhost
    127.0.1.1 ale www.ale.ch
    127.0.1.2 www.crisps.ch
    can't help you more than this...but hth.
    gnu/linux is not windoze

    Comment

    Working...
    X