LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-12-2006, 10:17 PM   #1
marsguy
Member
 
Registered: Nov 2004
Distribution: Red Hat Enterprise & SuSe 10
Posts: 77

Rep: Reputation: 15
the little problem with my apache


Hello

I have a little problem with my apache

I installed apache 2.2.2 then installed PHP 5.1.4.

My problem is:

I have defined 2 Virtual Host like this:

<VirtualHost *>
ServerAdmin me@myemail.net
DocumentRoot /usr/local/apache2/htdocs/cv
ServerName cv.mydomain.com
ErrorLog logs/cv.mydomain.com-error_log
CustomLog logs/cv.mydomain.com-access_log common
</VirtualHost>

<VirtualHost *>
ServerAdmin me@myemail.net
DocumentRoot /usr/local/apache2/htdocs/mydomain
ServerName www.mydomain.com
ServerALias mydomain.com
ErrorLog logs/mydomain.com-error_log
CustomLog logs/mydomain.com-access_log common
</VirtualHost>

I also defined my Document Root to be:

DocumentRoot "/usr/local/apache2/htdocs"

I put an "index.html" page in the above path.

My problem is: when I type my Server's IP address in the browser it shows the site listed in the first <VirtualHost> tag which is "cv.mydomain.com" in this case. it does not show my index file located in "usr/local/apache2/htdocs/index.html".

but when I commented the 2 <VirtualHost> , it showed my "usr/local/apache2/htdocs/index.html" successfully!!

any ideas why this happen? why doesn't it show my "usr/local/apache2/htdocs/index.html" when I type my IP address? and why I have to comment the 2 <VirtualHost> to make this happen?

thanks
 
Old 05-13-2006, 12:06 AM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
I'm not sure exactly why this is, but when you access an Apache server configured for named based virtual hosting by IP address, it goes to the first virtual host. In any case, the solution is simple -- add a "default" vertual host above your two already defined virtual hosts and set /usr/local/apache2/htdocs as its DocumentRoot. The ServerName would be whatever the hostname of your machine is set to.
 
Old 05-15-2006, 03:27 PM   #3
marsguy
Member
 
Registered: Nov 2004
Distribution: Red Hat Enterprise & SuSe 10
Posts: 77

Original Poster
Rep: Reputation: 15
Thank you so much

It worked
 
  


Reply


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
Strange apache trailing / problem - Slack-current, apache 1.3.33 vamp Linux - Networking 1 01-30-2005 07:28 PM
RH9: PHP session problem (or Apache problem) fengcn Red Hat 0 12-01-2003 06:32 PM
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 07:45 PM
Apache problem... blackmask Linux - Software 1 07-23-2003 10:50 AM
apache benchmarks (apache v13 / apache v20) ; large differences between benchmarking markus1982 Linux - Software 0 02-08-2003 10:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:44 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
Open Source Consulting | Domain Registration