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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-17-2006, 05:11 PM
|
#1
|
|
Member
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 518
Rep:
|
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.
|
|
|
|
02-18-2006, 10:36 AM
|
#2
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,363
|
You miss a "ServerName" directive inside your VirtualHost definition:
Code:
<VirtualHost *>
ServerName www.example.com
DocumentRoot /home/example.com
</VirtualHost>
|
|
|
|
02-18-2006, 11:10 AM
|
#3
|
|
Member
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 518
Original Poster
Rep:
|
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
|
|
|
|
02-18-2006, 11:46 AM
|
#4
|
|
Member
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 518
Original Poster
Rep:
|
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.
|
|
|
|
02-18-2006, 12:12 PM
|
#5
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,363
|
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.
|
|
|
|
|
02-18-2006, 12:23 PM
|
#6
|
|
Member
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 518
Original Poster
Rep:
|
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.
|
|
|
|
02-18-2006, 12:36 PM
|
#7
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,363
|
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.
|
|
|
|
02-18-2006, 12:49 PM
|
#8
|
|
Member
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 518
Original Poster
Rep:
|
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.
|
|
|
|
02-18-2006, 01:08 PM
|
#9
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,363
|
Just 2 things:
1.
Replace
Quote:
|
NameVirtualHost 00.00.00.00
|
with
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
|
|
|
|
02-18-2006, 01:31 PM
|
#10
|
|
Member
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 518
Original Poster
Rep:
|
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.
|
|
|
|
02-18-2006, 02:03 PM
|
#11
|
|
Member
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 518
Original Poster
Rep:
|
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?
|
|
|
|
02-18-2006, 05:22 PM
|
#12
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,363
|
It should work with this configuration. I don't know what else to think. Run:
and post the output.
|
|
|
|
02-21-2006, 03:37 AM
|
#13
|
|
Member
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 518
Original Poster
Rep:
|
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:03 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|