LinuxQuestions.org
Help answer threads with 0 replies.
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 12-12-2010, 04:46 PM   #1
twisteguy22
LQ Newbie
 
Registered: Jun 2010
Posts: 16

Rep: Reputation: 1
name based severs and subdomains - how to configure - apache2


hi all.

When I first encountered this problem, I though it would be a simple solution, but i must just be missing something obvious.

i have a few name based hosts configured in apache.

when i go to "www.adomainname.com" i get the first website on this list, not "adomainname.com", as i would like. Does anyone have any ideas on how to fix this?


here is the relevant part of my config files:

Code:
<VirtualHost *:80>
DocumentRoot "/var/www/httest"
ServerName hhexamplehh.selfip.com
<Directory "/var/www/httest">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName tempesthostingservices.com
DocumentRoot /var/www/tempest
<Directory /var/www/tempest/>
   allow from all
   Options +Indexes
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
   AllowOverride All
   allow from all
   Options +Indexes
</Directory>
SetEnv SITE_ROOT /var/www/tempest
SetEnv SITE_HTMLROOT /var/www/tempest
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "/var/www/brownstonehall"
ServerName brownstonehall.com
<Directory "/var/www/brownstonehall">
   AllowOverride All
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
   allow from all
   Options +Indexes
</Directory>
#SetEnv SITE_ROOT /var/www/brownstonehall
#SetEnv SITE_HTMLROOT /var/www/brownstonehall
</VirtualHost>
 
Old 12-12-2010, 05:12 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,962

Rep: Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341
Hi,

There is no www.adomainname.com vhost definition, so apache shows the default vhost (that is the 1st on the list)
 
Old 12-12-2010, 05:32 PM   #3
twisteguy22
LQ Newbie
 
Registered: Jun 2010
Posts: 16

Original Poster
Rep: Reputation: 1
sorry, perhaps i was misleading in my OP.

i mean that if i go to any other domain name such as brownstonehall.com, it goes to the first vhost entry instead.

i am trying to make it so www.brownstonehall.com goes the the same place as brownstonehall.com.

is there any way to do that?
 
Old 12-12-2010, 05:48 PM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,962

Rep: Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341
In that case you should use:
Code:
<VirtualHost *:80>
DocumentRoot "/var/www/brownstonehall"
ServerName brownstonehall.com
ServerAlias www.brownstonehall.com
...
Regards
 
Old 12-12-2010, 08:00 PM   #5
twisteguy22
LQ Newbie
 
Registered: Jun 2010
Posts: 16

Original Poster
Rep: Reputation: 1
thank you very much.
 
  


Reply

Tags
apache2, httpd, 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
Subdomains centos/apache2 X-M4-X Linux - Networking 4 01-06-2010 02:15 AM
Apache2 Local Subdomains miragej Linux - Server 8 06-22-2009 03:02 PM
apache2 setup/test subdomains on LAN DeltaXFX Linux - Server 5 11-04-2007 11:16 AM
User Based Subdomains Cottsay Linux - Software 0 11-02-2005 11:14 AM
Subdomains on Apache2 with virtual hosts - how? <Ol>Origy Linux - Networking 2 08-18-2005 06:53 AM


All times are GMT -5. The time now is 02:11 AM.

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