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 |
You miss a "ServerName" directive inside your VirtualHost definition:
Code:
<VirtualHost *> |
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:
my webpointing is www.example.com -> myIP |
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.
|
From the apache vhost documentation:
Quote:
|
Quote:
|
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. |
Thanks for helping Bathory!
the log says only Quote:
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. |
Just 2 things:
1. Replace Quote:
Code:
NameVirtualHost * Also use: Code:
ServerName www.example.com 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 |
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... |
Ok, Hier it is:
I gave the hostname from the server as ServerName and then mage a VirtualHost for ihn: Quote:
But it still doesn't work for the other virtualhost example.com and example2.com We're guetting close... Any idea? |
It should work with this configuration. I don't know what else to think. Run:
Code:
httpd -S |
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.
|
All times are GMT -5. The time now is 12:14 AM. |