LinuxQuestions.org
Register a domain and help support LQ
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 02-17-2006, 05:11 PM   #1
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Rep: Reputation: 31
apache: shows only my index.php and no other file!


Hi!
I've just installed apache2 and PHP.
When I try to reach different pages on my website I only get to see the index.php. No matter if I write: www.example.com/page1.html or www.example.com/page2.php, I only get to see index.php.
only if I write my IP-address instead of the hostname, then I get to see the page I want.
I just got a virtual server. I gave the IP addresse for the webpointing and hier is the virtualhost configuration:

<VirtualHost *>
DocumentRoot /home/example.com
</VirtualHost>

What did I do wrong?
What do I do wrong?
Thanks for any help. I'm trying around since a few hours now!

XpucTo

Last edited by xpucto; 02-18-2006 at 09:38 AM.
 
Old 02-18-2006, 10:36 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
You miss a "ServerName" directive inside your VirtualHost definition:
Code:
<VirtualHost *>
ServerName www.example.com
DocumentRoot /home/example.com
</VirtualHost>
 
Old 02-18-2006, 11:10 AM   #3
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
I added that too but the problem is still here.
Actually when I just give my IP address, I get the index.php from the first virtualhost. Shouldn'I get the index.php from the DocumentRoot (/home) that I defined outside the virtualhost?
my ipf.conf looks like this right now:
Quote:
DocumentRoot /home
NameVirtualHost 00.00.00.00

<VirtualHost *>
ServerName www.example.com
DocumentRoot /home/example.com
</VirtualHost>

<VirtualHost *>
ServerName www.example2.com
DocumentRoot /home/example2.com
</VirtualHost>
So if i type 00.00.00.00.00 I get the index.php of my example.com instead of the one from my DocumentRoot. And if I type 0.00.00.00.00/example.com/index.php, it doesn't find anything.
my webpointing is www.example.com -> myIP
 
Old 02-18-2006, 11:46 AM   #4
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
Ok, I think apache just take the DocumentRoot from the 1st DocumentRoot and shows one of the file in it, and doesn't show any other file or any subdirectory.
 
Old 02-18-2006, 12:12 PM   #5
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
From the apache vhost documentation:
Quote:
Now when a request arrives, the server will first check if it is using an IP address that matches the NameVirtualHost. If it is, then it will look at each <VirtualHost> section with a matching IP address and try to find one where the ServerName or ServerAlias matches the requested hostname. If it finds one, then it uses the configuration for that server. If no matching virtual host is found, then the first listed virtual host that matches the IP address will be used.
 
Old 02-18-2006, 12:23 PM   #6
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by bathory
It doesn't explain anything because it soulf be abble to show something else as index.php! It can't show neither files in the same folder or files in sub-folders.
 
Old 02-18-2006, 12:36 PM   #7
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
If I understand well your setup, then when you give the IP address, apache will match it with the ServerName and will use the <VirtualHost> that matches ServerName. I guess that in your case it's www.example.com with DocumentRoot /home/www.example.com
Check the error log to see if it tries to find the page under /home/www.example.com/www.exampple.com/index.php
Also check if http://www.example.com and http://www.example2.com work as expected.
 
Old 02-18-2006, 12:49 PM   #8
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
Thanks for helping Bathory!
the log says only
Quote:
File does not exist: /home/favicon.ico
/home being my DocumentRoot. I don't understand why it is looking for this file!
Nothing works as expected! I really don't understand why beacause I've already done this before with no problem.
Now I've diseabled all my virtualhosts.
So http://www.example.com and http://www.example2.com are pointing to my IP addresse, DocumentRoot is /home, ServerName is my IP (I tried also with nothing) and that's it I guess.
When I typed now http://www.example.com or http://www.example2.com I get index.html that is located in /home (my DocumentRoot), this is correct, BUT if I give
www.example(2).com/anotherindex.html or www.example(2).com/subdir/file.php, then I still get this index.html!
only by typing the IP address works everything.

Last edited by xpucto; 02-18-2006 at 12:55 PM.
 
Old 02-18-2006, 01:08 PM   #9
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Just 2 things:
1.
Replace
Quote:
NameVirtualHost 00.00.00.00
with
Code:
NameVirtualHost *
since you use the * in <VirtualHost *>
Also use:
Code:
ServerName www.example.com
and not the IP address.
BTW favicon.ico is the tiny image at the left of the address in the address-bar of your browser (like the little penguin displayed for LQ)
2.
From your profile I see you use Suse and FC. Is that happening with FC then it should be SELinux that is enabled by default. Take a look here to see what you can do
 
Old 02-18-2006, 01:31 PM   #10
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
Thanks but it didn't help.
The difference is that now it doesn't work anymore with the IP!
In that case I'm working with RH9 (it 's on a virtual server from a Webhosting provider). I'm beguinning to think that something gone wrong during the installation...

Last edited by xpucto; 02-18-2006 at 01:42 PM.
 
Old 02-18-2006, 02:03 PM   #11
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
Ok, Hier it is:
I gave the hostname from the server as ServerName and then mage a VirtualHost for ihn:
Quote:
ServerName hostname-Server.com
<VirtualHost *>
ServerName hostname-Server.com
DocumentRoot /home
</VirtualHost>
It works now for ihn. I can do for example hostname-Server.com/example.com/index.html and I get to see the correct page.
But it still doesn't work for the other virtualhost example.com and example2.com
We're guetting close... Any idea?
 
Old 02-18-2006, 05:22 PM   #12
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
It should work with this configuration. I don't know what else to think. Run:
Code:
httpd -S
and post the output.
 
Old 02-21-2006, 03:37 AM   #13
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
Thanks bathory for helping! I finally found out that there was a problem with the dns manager. Afterward I had to put also an aliasserver in my virtualhost. Now it works. Thanks again for your support, I certainly appreciate.
 
  


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
Apache problem - cannot get index.html file to show nebloof Linux - Software 3 01-15-2005 10:32 PM
Trouble opening index.php file to install eZ publish jedson Linux - Software 2 11-01-2004 07:22 AM
Apache php index.php problem neurotic Linux - Software 3 11-18-2003 06:02 PM
Apache index file Location avoll Linux - Networking 2 11-03-2003 07:10 AM
Apache 2.0 search for index.html file pawlub Linux - Software 2 10-28-2003 10:03 AM


All times are GMT -5. The time now is 10:00 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