Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2005
    Posts
    40

    Getting 403 error when I define virtualhost

    Hi everyone,

    I have apache set up and it works fine from the DocumentRoot when I access the server via the IP. I've set up the following virtualhost

    Code:
    <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot "/home/jason/public_html/"
        ServerName jasonkruse.com
        ServerAlias www.jasonkruse.com
        #ErrorLog "logs/jasonkruse.com-error_log"
        #CustomLog "logs/jasonkruse.example.com-access_log" common
    </VirtualHost>
    That document root does exist and has read permission for everyone, but when I restart apache I get a 403 error when I access jasonkruse.com and when I access the IP in a browser. If I comment out the virtualhost directive and restart Apache, I no longer get a 403 when I access the IP.

    Any ideas?

  2. #2
    Join Date
    Apr 2005
    Posts
    1,711
    I would tail the error log, to get more detailed description of why you are getting a 403.

  3. #3
    Join Date
    Nov 2005
    Posts
    40
    Thanks for the tip. The error was :

    /home/jason/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable.

    So I moved .htaccess out of public_html into its parent folder (not sure why its looking out there....) and I had to make not only the .htaccess readable, but the entire /home/jason dir too for it to like it.

    Thanks again

  4. #4
    Join Date
    Jun 2003
    Posts
    364
    Hi,

    This is probably because the httpd process was unable to access the public_html directory.

    For a process to access the directory it must at least have the x (execute) permissions on all the parent directories.

    i.e. chmod o+x {/home,/home/jason,/home/jason/public_html}

    Assuming that the apache process runs as nobody.

  5. #5
    Join Date
    Jan 2006
    Location
    Athens, Greece
    Posts
    1,479
    No, revert back from your 2nd post actions and add this:

    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/home/jason/public_html"
    ServerName jasonkruse.com
    ServerAlias www.jasonkruse.com
    #ErrorLog "logs/jasonkruse.com-error_log"
    #CustomLog "logs/jasonkruse.example.com-access_log" common
    <Directory "/home/jason/public_html">
    Options None # ... it depends
    AllowOverride all
    Order allow,deny
    Deny from all
    </Directory>
    </VirtualHost>

    Remove the last slash from DocumentRoot

Posting Permissions

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