apache: shows only my index.php and no other file!
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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:
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:
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
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.
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.
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.
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.
/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.
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
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...
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.