Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-04-2008, 09:27 AM   PM User | #1
Active X
New Coder

 
Join Date: Aug 2007
Posts: 74
Thanks: 3
Thanked 2 Times in 2 Posts
Active X is an unknown quantity at this point
Exclamation Default document in Apache

Hello to all dear developers,

I've just installed Apache 2.2.8 and have installed php 5.2.6 on it as a module.

I've created a web site that has index.php as it's default document, but anytime I enter the address of web site in IE address bar, I get "Index of sitename".

How can I define a default document for my Apache server ?



My second problem : I change DocumentRoot in httpd.conf and restart the server. It doesn't show me any errors. But when I enter address of a web site in address bar I get to "Error 403: Forbidden".
I changed security permission of that folder to "Everyone : Full control" ! but it still doesn't work.

Could someone explain me how to fix these 2 problems ?


Will be really thankful to your helps
Active X is offline   Reply With Quote
Old 06-04-2008, 09:31 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
How can I define a default document for my Apache server ?
Add an .htaccess file into your root having
Code:
DirectoryIndex  index.php index.html index.htm default.html default.htm home.html
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 06-05-2008, 05:11 AM   PM User | #3
Active X
New Coder

 
Join Date: Aug 2007
Posts: 74
Thanks: 3
Thanked 2 Times in 2 Posts
Active X is an unknown quantity at this point
Thank you very much abudraoof,

And can you answer my second question too ?

I need to know how to change my default document directory.

Will be really thankful to helps again!
Active X is offline   Reply With Quote
Old 06-05-2008, 05:17 AM   PM User | #4
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
Check the Apache error log for the domain. It should provide some useful information. Sounds like you're using Windows, so look somewhere around /path/to/Apache2/logs/error.log. If you set up vhosts and proper logging, the filename will be whatever you put in the site config.
tomws is offline   Reply With Quote
Old 06-05-2008, 10:20 AM   PM User | #5
Active X
New Coder

 
Join Date: Aug 2007
Posts: 74
Thanks: 3
Thanked 2 Times in 2 Posts
Active X is an unknown quantity at this point
Thanks tomws, but could you explain me a little more about what to do ?

and what to do with .htaccess to setup the default document name ?
Active X is offline   Reply With Quote
Old 06-05-2008, 02:06 PM   PM User | #6
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
Quote:
Originally Posted by Active X View Post
Thanks tomws, but could you explain me a little more about what to do ?
I think I did. Check the error log in the logs directory and see if it lists any errors.

Quote:
Originally Posted by Active X View Post
and what to do with .htaccess to setup the default document name ?
First, check the error log in the logs directory and see if it lists any errors for your current config.

I don't use htaccess as I have access to the server config. And if I understand htaccess correctly, you can't set up the doc root there. It should be done in the host config file.

Here's an example from my virtual host config file on an internal windows server.
Code:
<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    DocumentRoot "c:/Program Files/Apache Software Foundation/Apache2.2/htdocs/test.example.com"
    ServerName test.example.com
    ErrorLog logs/test-example-com_error.log
    CustomLog logs/test-example-com_access.log common

    <Directory "htdocs/test.example.com/">
        Order deny,allow
        Deny from all
        Allow from 192.168.1.102
        # your directory entry would be quite different from this for a production site
    </Directory>
</VirtualHost>
Path are relevant to the Apache root directory as defined in the main config.
tomws is offline   Reply With Quote
Old 06-06-2008, 06:48 AM   PM User | #7
Mikroz
New Coder

 
Join Date: Mar 2008
Location: Finland
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
Mikroz is an unknown quantity at this point
Well Apache 2.2.8 set's its local priviledges very strict from the beginning, look for the row ~187 in httpd.conf
Code:
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#
# First, we configure the "default" to be a very restrictive set of 
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all <--- Change this to Allow from all 
</Directory>
That's what is restricting everything beneath your doc root unless you want to specify with .htaccess...

But if mostly public content in the site I would conf the httpd.conf to allow from the web documents folder and restrict anything else with .htaccess or other methods.
Mikroz is offline   Reply With Quote
Old 06-08-2008, 08:28 AM   PM User | #8
Active X
New Coder

 
Join Date: Aug 2007
Posts: 74
Thanks: 3
Thanked 2 Times in 2 Posts
Active X is an unknown quantity at this point
Thank you vey very much.

I think I really should study about Apache server much more than my current knowledge.

Could someone introduce me a good resource for studying about apache (Some thing like a tutorial) ?
Active X is offline   Reply With Quote
Old 06-10-2008, 06:16 AM   PM User | #9
Mikroz
New Coder

 
Join Date: Mar 2008
Location: Finland
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
Mikroz is an unknown quantity at this point
You don't need to look for everything in Apache but I suggest you bookmark at least this page: http://httpd.apache.org/docs/2.2/

Might look a bit messy on the first looks but with a little study it's the best resource there is. And of course there is google if lookin for help with a particular module etc.
Mikroz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate 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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:47 AM.


Advertisement
Log in to turn off these ads.