Forbidden Error 403 - Unable to access web pages

Discussion in 'Server Operation' started by skyeman, Mar 2, 2010.

  1. skyeman

    skyeman New Member

    On rebuilding an ubuntu "perfect server" 9.10 (Karmic) (ISPConfig-3) mail and web server, after a hdd failure, I'm encountering difficulties serving my web pages. The browser reports either 403 Forbidden errors, or 403 Forbidden and/or 404 Document not Found.

    The server error log reports:

    [crit] [client xxx.xxx.xxx.xxx] (13)Permission denied: /var/www/mydomain.com/web/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

    Prior to this error, I was opening pages ok, right up until I used ISPConfig to create a sub-domain with a redirect path instruction. After that, nothing would open at all: http://mydomain.com , http://www.mydomain.com, http://mydomain.com/path-to-subdom-index.html , etc. All of them get 403's now, whereas before using ISPConfig sub-domain tool, those would open content.

    It's baffling, because the prior server also used ISPConfig 3 and ubuntu 9.10, and I don't recall encountering these problems.

    Any help deeply appreciated...

    Elliott
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    ls -la /var/www/mydomain.com/web/
    ?
     
  3. skyeman

    skyeman New Member

    Hello, Falco, and thanks for the reply...

    ls -la yields:

    Code:
    root@server1:/var/www/mydomain.com/web# ls -la
    total 32
    drwx--x--- 4 root root    4096 2010-03-03 12:30 .
    drwxr-xr-x 3 root root    4096 2010-01-18 10:10 ..
    drwxr-xr-x 2 web1 client0 4096 2010-03-02 18:33 error
    -rw-r--r-- 1 web1 client0 1406 2010-03-02 18:33 favicon.ico
    -rw-r--r-- 1 web1 client0  683 2010-03-02 18:33 feed.xml
    -rw-r--r-- 1 web1 client0    0 2010-03-02 18:33 .htaccess
    -rw-r--r-- 1 web1 client0 1861 2010-03-02 18:33 index.html
    -rw-r--r-- 1 web1 client0   34 2010-03-02 18:33 robots.txt
    drwxr-xr-x 2 web1 client0 4096 2010-03-02 00:30 stats
    
    For http://mydomain.com , this produces:

    Forbidden

    "You don't have permission to access / on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request." associated with this in the server log:
    Code:
    [Wed Mar 03 12:40:20 2010] [crit] [client 66.xxx.xxx.xxx] (13)Permission denied: /var/www/mydomain.com/web/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
    [Wed Mar 03 12:40:20 2010] [error] [client 66.xxx.xxx.xxx] File does not exist: /usr/share/apache2/error/403.html
    
    
    Interestingly, cat .htaccess reveals an empty file. Huh? Can that be right?

    The sub-domain structure of the system which had hdd failure was pretty complex, with squirrelmail and four other sub-webs routed by re-directs I built with ispconfig-3. Now, I can't seem to get a handle on getting even the default web to work. I've probably muddled things up a bit with this, but I don't think it will take a complete rebuild. Egad, i hope not...

    What next?
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Try this:
    Code:
    chmod 755 /var/www/mydomain.com/web
     
  5. skyeman

    skyeman New Member

    Yes, thank you, 'chmod 755 web' removes the 403 error, and permits the default 'Welcome' page to load.

    However, as I attempt to add sub-domains using ispconfig-3, the 403 error re-occurs at times. I'm not sure what I'm doing to trigger this. Do you know?

    Anyway, I'll keep notes, and I might have other questions for you.

    Thanks for pointing me at those pesky permissions.
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Can you check if the permissions of the /var/www/mydomain.com/web have changed when the 403 error re-occurs?
     
  7. skyeman

    skyeman New Member

    Observations and testing:

    The configuration of mydomain.com, from ispconfig-3 shows all this:
    HarddiskQuota:-1, CGI+, SSI+, SuEXEC+, OwnErrorDocs+, AutoSubDomain:*. , SSL+, PHP:Fast-CGI , Active+ .

    The core web domain has a Redirect configured, thus: Redirect Type: L, Redirect Path: /subdomain/

    Immediately after running: chmod 755 /var/www/mydomain.com/web , I am able to reach the default ispconfig 'welcome' page, as well as the correctly configured subdomain, BUT: If I make any change to core web domain's Redirect tab, and hit save, then I start getting the 403 errors to all pages.

    I made this change to the web redirect: http://subdomain.mydomain.com ,(and DNS is properly configured for this subdomain). After modifying the web redirect, looking at the permissions of ~/web, I find them to be 710 (drwx--x---). So, again, I run chmod 755 web, and I'm back to my previous status, where i can reach the default 'welcome', and the subdomain I mentioned.

    The web redirect did not seem to work, and I'm unfamiliar with where in the file structure it's making changes. I'm actually trying to get any request for http://mydomain.com and http://www.mydomain.com to instead open http://subdomain.mydomain.com .

    So, I modified Auto-Subdomain on the webdomain Website tab to : www.

    AGAIN, the permissions at web got changed to 710, with 403 errors. Again, I did chmod 755 web.

    Now, there is peace: All (mydomain.com , www.mydomain.com, and subdomain.mydomain.com) are correctly opening my gate-way subdomain page to my webs.

    So, why does making changes in the Web Domain Website and Redirect tabs cause a permissions change at /var/www/mydomain.com/web ? Can ( or should) I be able to reconfigure that behavior. Is it a bug, or a feature?

    :)

    And where, ideally, in the web file structure, should I be adding back my other subdomains? Will I run into difficulty with Auto-Subdomain set to :.www ? I seem to recall it working when set at .* on the previous server.

    I hope these notes make sense, and are helpful. Thanks, as ever, for your fine work with these how-to's, and for the assistance on this problem.
     

Share This Page