Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun Dec 30, 2007 3:40 pm 
Offline
Junior Member

Joined: Sun Dec 30, 2007 3:11 pm
Posts: 30
Website: http://www.triptoy.net
Hello,

Lets assume I am running Linode Debian 4.0 with Apache MySql & PHP. How would I configure my box to support multiple domains?

I was able to do this on several VPS's I have used in the past, but it was via some form of control panel.

For example:

www.testing123.net points to /home/testing123.net
www.example2.com points to /home/example2.com
www.apecraisins.org points to /home/apecraisins.org


Thanks!


Top
   
 Post subject:
PostPosted: Sun Dec 30, 2007 3:48 pm 
Offline
Senior Member
User avatar

Joined: Mon Dec 10, 2007 4:30 pm
Posts: 341
Website: http://markwalling.org
http://httpd.apache.org/docs/2.0/vhosts/


Top
   
 Post subject:
PostPosted: Sun Dec 30, 2007 5:53 pm 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
Or you could give this a go.

http://www.linode.com/wiki/index.php/User:Kangaby


Top
   
 Post subject:
PostPosted: Sun Dec 30, 2007 5:58 pm 
Offline
Junior Member

Joined: Sun Dec 30, 2007 3:11 pm
Posts: 30
Website: http://www.triptoy.net
mwalling wrote:
http://httpd.apache.org/docs/2.0/vhosts/

Nice reading material!


Quote:

Ahha! This is perfect, I will be reviewing every detail of this resource.


Top
   
 Post subject:
PostPosted: Sun Dec 30, 2007 9:56 pm 
Offline
Junior Member

Joined: Sun Dec 30, 2007 3:11 pm
Posts: 30
Website: http://www.triptoy.net
kangaby,

I ran into a problem on your wiki.
This is how I configured the default file.
(my website ip address is 67.18.186.137)

Code:
#/etc/apache2/sites-available/default

NameVirtualHost 67.18.186.137:80
<VirtualHost 67.18.186.137:80>
   ServerAdmin root@triptoy.net
   
   DocumentRoot /var/www/
   <Directory />
      Options FollowSymLinks
      AllowOverride None
   </Directory>




   <Directory /var/www/>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Order allow,deny
      allow from all
      # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # RedirectMatch ^/$ /apache2-default/
   </Directory>

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

   ErrorLog /var/log/apache2/error.log

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

   CustomLog /var/log/apache2/access.log combined
   ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>


I then configured these two files in the same directory as default, yet for some reason both domains still point to my /var/www

Code:
# /etc/apache2/sites-available/triptoy.net

 <VirtualHost 67.18.186.137:80>
 ServerName triptoy.net
 ServerAlias www.triptoy.net
 DocumentRoot "/home/triptoy.net/public_html"
 ScriptAlias /cgi-bin/ /home/triptoy.net/cgi-bin/
 </VirtualHost>


# /etc/apache2/sites-available/slivovitzmusic.com

 <VirtualHost 67.18.186.137:80>
 ServerName slivovitzmusic.com
 ServerAlias www.slivovitzmusic.com
 DocumentRoot "/home/slivovitzmusic.com/public_html"
 ScriptAlias /cgi-bin/ /home/slivovitzmusic.com/cgi-bin/
 </VirtualHost>


Top
   
 Post subject:
PostPosted: Mon Dec 31, 2007 6:52 am 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
They look ok to me, and yes they are all opening the same content.

Have you restarted Apache, etc/init.d/apache2 restart since setting up the virtual hosts?

I suspect not, as it is not mentioned in the tutorial. When I did my setup, I set everything first and then restarted apache.

Edit: It is now. :D


Last edited by kangaby on Mon Dec 31, 2007 8:55 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Mon Dec 31, 2007 8:07 am 
Offline
Junior Member

Joined: Sun Dec 30, 2007 3:11 pm
Posts: 30
Website: http://www.triptoy.net
I reloaded it twice, yet I have not tried rebooting the server. I have to head out for work, but I'll try again when I get home.

Thanks


Top
   
 Post subject:
PostPosted: Mon Dec 31, 2007 8:23 am 
Offline
Senior Member

Joined: Sat Jun 05, 2004 12:49 am
Posts: 333
Did you:

Code:
a2ensite triptoy.net && a2ensite slivovitzmusic.com 
?


Top
   
 Post subject:
PostPosted: Mon Dec 31, 2007 9:03 am 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
OverlordQ wrote:
Did you:

Code:
a2ensite triptoy.net && a2ensite slivovitzmusic.com 
?


I've added this as well. That's the problem when you go from Apache 1 to Apache 2 and don't write every single thing down.


Top
   
 Post subject:
PostPosted: Mon Dec 31, 2007 12:00 pm 
Offline
Senior Member
User avatar

Joined: Mon Dec 10, 2007 4:30 pm
Posts: 341
Website: http://markwalling.org
AFAIK, if you are using the sites-available/ file layout for httpd, you also need to create symlinks to those files from sites-enabled as that is where apache actually gets the files to load.


Top
   
 Post subject:
PostPosted: Mon Dec 31, 2007 12:49 pm 
Offline
Senior Member
User avatar

Joined: Sun Feb 08, 2004 7:18 pm
Posts: 562
Location: Austin
mwalling,

That's what I always do: set up the symlinks in sites-enabled manually. But I believe that's exactly what the a2ensite tool does.


Top
   
 Post subject:
PostPosted: Tue Jan 01, 2008 7:57 pm 
Offline
Junior Member

Joined: Sun Dec 30, 2007 3:11 pm
Posts: 30
Website: http://www.triptoy.net
Should I comment out "DocumentRoot /var/www/" in the default file if I have a file for every website in the directory?


Top
   
 Post subject:
PostPosted: Wed Jan 02, 2008 6:37 pm 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
Or point it to a sub-directory of /var/www/ if you like


Top
   
 Post subject:
PostPosted: Wed Jan 02, 2008 6:40 pm 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
Xan wrote:
mwalling,
But I believe that's exactly what the a2ensite tool does.


That's what it does. There are a2en* and a2dis* for sites and modules.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group