LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 01-20-2010, 05:19 PM   #1
LazerPhreak
Member
 
Registered: Dec 2009
Location: USA
Distribution: Ubuntu Server / Desktop / UNR
Posts: 117

Rep: Reputation: 17
How to set up subdomains on Ubuntu Server


Here's my dillema. I have set up a dedicated server running Ubuntu Server Edition. I have apache2 installed and running great. I wish to let friends and family host their individiual websites on it, but I'm running into a bit of a dillema. It seems that my server automatically redirects them to my home page and not theirs.

This is how I am set up:
All apache files stored in /var/www
My main page is /var/www/index.html
the website is www.tweakercat.tk
redirects to /var/www/index.html

However, for example:
friends site is stored in folder /var/www/php
he has file /var/www/php/index.html
When i go to www.tweakercat.tk/php/index.html
It redirects to my page (/var/www/index.html)

Same thing happens if i type www.tweakercat.tk/request.html (/var/www/request.html)

it automatically sends the browser to www.tweakercat.tk/index.html (/var/www/index.html)

What have I set up wrong?

Thanks in advance!
 
Old 01-20-2010, 05:34 PM   #2
LazerPhreak
Member
 
Registered: Dec 2009
Location: USA
Distribution: Ubuntu Server / Desktop / UNR
Posts: 117

Original Poster
Rep: Reputation: 17
UPDATE:
Just ran a test, skipping my domain name.

75.87.80.77/php
works
www.tweakercat.tk/php
does not

apparently www.tk doesnt allow domain extensions or something?
 
Old 01-21-2010, 04:11 AM   #3
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
You will need to configure apache to serve a virtual domain for tweakercat.tk
Currently apache only knows about the default domain, you will need to create a config file in /etc/apache2/sites-available and symlink it to /etc/apache2/sites-enabled
The file will need the following contents (at least)...

Code:
<VirtualHost tweakercat.tk>
   ServerAdmin webmaster@localhost
   ServerAlias www.tweakercat.tk
   DocumentRoot /var/www/php
   CustomLog /var/log/apache2/tweakercat.tk-access.log combined
</VirtualHost>
I would also recommend putting this site somewhere else than a directory called 'php'
I generally create a directory structure something like...

Code:
/var/www/default/   (default site)
         www.site1.com/
         www.site2.com/
         www.siteX.com/
and have the appropriate files in /etc/apache2/sites-available

Last edited by nowonmai; 01-21-2010 at 04:12 AM.
 
Old 01-21-2010, 09:13 AM   #4
LazerPhreak
Member
 
Registered: Dec 2009
Location: USA
Distribution: Ubuntu Server / Desktop / UNR
Posts: 117

Original Poster
Rep: Reputation: 17
Hello and thanks for the reply!

Yes, I understand about not putting it in php. That was simply a test folder in which i created to solve this problem. Now heres the question that remains. How much of that do i need to repeat in the original config file to set up another one on top of that? And what whould I seperate the 2 with in the file?

Thanks!
 
Old 01-22-2010, 05:38 AM   #5
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
I'm not sure if I understand the question correctly, but if you are asking how to create multiple virtual servers, you will need to create a config file as above for each site in the /etc/apache2/sites-available directory and then symlink it to /etc/apache2/sites-enabled, ensuring that the config files contain the correct directory information for the site they relate to.
I believe you can use debian provided scripts to do this also... I have no experience with them, but there is more information here.
 
  


Reply

Tags
apache, friends, server, ubuntu


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dovecot & postfix ssl (multiple subdomains for 1 server?) deathsfriend99 Linux - Server 0 07-21-2009 01:34 PM
how can i set two lan cards in ubuntu server 8.10 machinakias Linux - Server 5 01-02-2009 09:18 PM
How to set-up VPN (poptop) on Ubuntu server newbie-dan Linux - Server 1 09-04-2008 11:03 AM
LXer: Set Up Ubuntu-Server 6.10 As A Firewall/Gateway For Your Small Business Environment LXer Syndicated Linux News 0 11-26-2006 09:54 AM
Trying to set-up a web server on ubuntu 5.10 jazee Linux - Software 4 03-14-2006 11:19 PM


All times are GMT -5. The time now is 06:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration