LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 10-05-2009, 05:57 AM   #1
dlugasx
Member
 
Registered: Dec 2008
Location: Germany/Poland
Distribution: CentOS / Debian / Solaris / RedHat
Posts: 250

Rep: Reputation: 18
Apache - problem with virtual host


Hi all,


on my server I have connected domain:

www.my-first-domain.com which is installed in /var/www/first

For that domain I have installed virtual host.


Quote:
<VirtualHost *>
ServerName www.my-first-domain.com
ErrorLog /var/log/apache2/my-first-domain.com-error.log
TransferLog /var/log/apache2/my-first-domain.com-access.log

DocumentRoot /var/www/first/
<Directory /var/www/first/>
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php index.html
AllowOverride None
Order allow,deny
allow from all
</Directory>

</VirtualHost>



I dont know why, when I will put address

my-first-domain.com instead of www.my-first-domain.com

server redirect that domain to folder /var/www/.


Does anybody knows whats going on ?
 
Old 10-05-2009, 06:08 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,467
Blog Entries: 11

Rep: Reputation: 184Reputation: 184
Did you restart the apache?

Give us the output of
Code:
apachectl -S
this will print all virtual domains apache finds in its configuration
If you go with apache2 use

Code:
apache2ctl -S
 
Old 10-05-2009, 06:09 AM   #3
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,467
Blog Entries: 11

Rep: Reputation: 184Reputation: 184
double post

Last edited by zhjim; 10-05-2009 at 06:10 AM. Reason: double post
 
Old 10-05-2009, 06:21 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Add
Code:
ServerAlias my-first-domain.com
after ServerName and restart apache.

Regards
 
Old 10-05-2009, 06:28 AM   #5
dlugasx
Member
 
Registered: Dec 2008
Location: Germany/Poland
Distribution: CentOS / Debian / Solaris / RedHat
Posts: 250

Original Poster
Rep: Reputation: 18
Thumbs up

Quote:
Originally Posted by bathory View Post
Add
Code:
ServerAlias my-first-domain.com
after ServerName and restart apache.

Regards
Big beer for that man Thanks, I forgot about alias .
 
Old 10-05-2009, 06:41 AM   #6
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Thx for the beer. Cheers!!!

Btw, you can mark your thread as solved.
 
Old 10-05-2009, 07:36 AM   #7
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,467
Blog Entries: 11

Rep: Reputation: 184Reputation: 184
Damn I want one two

Just for my peace of mind.
Do you really need a ServerAlias to get it working? Specially when you have a ServerName allready set?
As far I got it you would need a ServerAlias directive for something like this.
Code:
ServerName my-domain.com
ServerAlias www.my-domain.com
 
Old 10-05-2009, 07:58 AM   #8
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
@zhjim

You need ServerAlias whenever you want your vhost to listen to alternative names regardless if the ServerName uses the fqdn, or just the domain name.

Regards
 
Old 10-05-2009, 10:01 AM   #9
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,467
Blog Entries: 11

Rep: Reputation: 184Reputation: 184
Quote:
Originally Posted by bathory View Post
@zhjim

You need ServerAlias whenever you want your vhost to listen to alternative names regardless if the ServerName uses the fqdn, or just the domain name.

Regards
Thanks for the explanation just like I had it in my mind
 
  


Reply

Tags
www


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
Apache 2.2.3 Virtual Host Problem kitek Linux - Networking 1 01-09-2008 06:35 PM
Apache virtual host problem. dave`2005 Linux - Software 2 05-26-2006 10:11 PM
Apache Virtual Host Problem eckertc1 Linux - Newbie 11 03-23-2005 04:31 PM
Apache Virtual Host problem Seventh Linux - Software 2 03-19-2005 07:33 PM
Apache virtual host problem Adrohak Linux - Software 3 07-18-2004 05:17 PM


All times are GMT -5. The time now is 10:18 PM.

Main Menu
Advertisement
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