FedoraForum.org - Fedora Support Forums and Community
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2009
    Location
    Fairbanks, AK
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Forbidden when changind documentRoot path in httpd.conf

    This is prob going to sound dumb. Here is my issue, my DocumentRoot default path is /var/www/html which I think is standard from the install in the httpd.conf file

    I want to move this path to my active user account /home/me/html Hence changing the default website to a place I can access, as I can't FTP , and upload webpages etc...when I FTP as my normal user I can't access /var/www/html to upload stuff.

    When I change the path and restart httpd I get the 403 error and it said it was looking at / which is not the path I specified.... I just don't understand why apache is not directing to the right location and giving me the 403 error. Any ideas?

    Thanks!
    Last edited by Lonny; 3rd November 2009 at 12:01 AM.

  2. #2
    Join Date
    May 2009
    Location
    eastern Washington (state) USA
    Posts
    488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lonny,

    try this thread, or this one, there's a link to a tutorial (that I haven't checked out yet!)

    Also, in the servers topic there's a 'how to' thread that has a lot of good info. if you need it!

  3. #3
    Join Date
    Nov 2009
    Location
    Fairbanks, AK
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a bunch, I will check them out, I looked through here, but there are always some you miss. I will let ya know.

  4. #4
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Setting your document root to "/home/me/html" defines how apache defines a "root" directory.
    All URL references (such as "http://hostname/name") start by getting redefined as
    "/home/me/html/me".

    Now for access - remember that apache does not run as the user. By default it runs as
    the "apache:apache" user:group. This is normal as it will prevent a vulnerability in
    apache from affecting any files you have. BUT - to grant apache access (read) you
    need to modify your home directory and grant world x access.

    This will allow apache to open directories (and files) if it knows what the name is.

    Since the document root is "/home/me/html" apache has access to the "me" directory,
    you must also give apache access to the "html" directory. If you want apache to be
    able to generate directory listings (usefull...) you need to grant world "rx" access.

    Now the URL "http://hostname/name.html" will look for a file named "name.html" in the
    document root.. which is "/home/me/html". If you use the URL "http://hostname/" then
    you should get a directory listing of /home/me/html.

  5. #5
    Join Date
    Nov 2009
    Location
    Fairbanks, AK
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I was coming back to post that I figured it out! Jpollard you are very correct, did a little chmod and everything works perfect. Thank you for the post! It's always the dumb things! I pulled my hair out all day over this.

  6. #6
    Join Date
    Jun 2006
    Location
    Texas
    Age
    55
    Posts
    4,164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My instruction are:
    Code:
    su -
    chmod 711 /home/marc
    chmod 755 /home/marc/Public
    setsebool -P httpd_enable_homedirs 1
    chcon -R -t httpd_sys_content_t /home/marc/Public
    vi /etc/httpd/conf/httpd.conf
    Should have these in your httpd.conf
    Code:
    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    #DocumentRoot "/var/www/html"
    DocumentRoot "/home/marc/Public"
    
    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    #<Directory "/var/www/html">
    <Directory "/home/marc/Public">
    Then you restart Apache
    Code:
    service httpd restart
    I got the chmod 711/755 from that same httpd.conf:
    Code:
    #
    # UserDir: The name of the directory that is appended onto a user's home
    # directory if a ~user request is received.
    #
    # The path to the end user account 'public_html' directory must be
    # accessible to the webserver userid.  This usually means that ~userid
    # must have permissions of 711, ~userid/public_html must have permissions
    # of 755, and documents contained therein must be world-readable.
    # Otherwise, the client will only receive a "403 Forbidden" message.
    #
    # See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
    #
    But remember, you are changing your web files LIVE. I build my web site on another PC then sftp to my web server. If I want to make a quick fix, I use Quanta Plus. Then update my development box.

  7. #7
    Join Date
    Nov 2009
    Location
    Fairbanks, AK
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you Marc. Perciate it

  8. #8
    Join Date
    Mar 2005
    Location
    Newcastle, Australia
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Forbidden when changind documentRoot path in httpd.conf

    I have updated httpd.conf

    Code:
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    #DocumentRoot "/var/www/html"
    DocumentRoot "/home/sayth/Public"
    
    #
    # Relax access to content within /var/www.
    #
    <Directory "/home/sayth">
        AllowOverride None
        # Allow open access:
        Require all granted
    </Directory>
    
    # Further relax access to the default document root:
    <Directory "/home/sayth/Public">
    However I cannot get it to serve file from ~/Public
    Last edited by flebber; 25th March 2014 at 10:58 AM.

  9. #9
    Join Date
    Mar 2005
    Location
    Newcastle, Australia
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Forbidden when changind documentRoot path in httpd.conf

    Oh I forgot to edit the userdir.conf

Similar Threads

  1. Replies: 2
    Last Post: 5th April 2007, 12:54 AM
  2. ci problems with /etc/httpd/conf/httpd.conf
    By lonelylost_brar in forum Servers & Networking
    Replies: 2
    Last Post: 8th June 2005, 08:17 PM

Tags for this Thread

Posting Permissions

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