Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Aug 2007
    Posts
    74
    Thanks
    3
    Thanked 2 Times in 2 Posts

    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

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Aug 2007
    Posts
    74
    Thanks
    3
    Thanked 2 Times in 2 Posts
    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!

  • #4
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    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.

  • #5
    New Coder
    Join Date
    Aug 2007
    Posts
    74
    Thanks
    3
    Thanked 2 Times in 2 Posts
    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 ?

  • #6
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    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.

  • #7
    New Coder
    Join Date
    Mar 2008
    Location
    Finland
    Posts
    21
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.

  • #8
    New Coder
    Join Date
    Aug 2007
    Posts
    74
    Thanks
    3
    Thanked 2 Times in 2 Posts
    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) ?

  • #9
    New Coder
    Join Date
    Mar 2008
    Location
    Finland
    Posts
    21
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •