Fedora Linux Support Community & Resources Center
  #1  
Old 2nd November 2009, 11:25 PM
Lonny Offline
Registered User
 
Join Date: Nov 2009
Location: Fairbanks, AK
Posts: 6
linuxfedorafirefox
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.
Reply With Quote
  #2  
Old 3rd November 2009, 03:02 AM
CiaW Offline
Registered User
 
Join Date: May 2009
Location: eastern Washington (state) USA
Posts: 489
linuxfedorafirefox
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!
Reply With Quote
  #3  
Old 3rd November 2009, 03:10 AM
Lonny Offline
Registered User
 
Join Date: Nov 2009
Location: Fairbanks, AK
Posts: 6
linuxfedorafirefox
Thanks a bunch, I will check them out, I looked through here, but there are always some you miss. I will let ya know.
Reply With Quote
  #4  
Old 3rd November 2009, 03:42 AM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 7,346
linuxfedorafirefox
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.
Reply With Quote
  #5  
Old 3rd November 2009, 03:51 AM
Lonny Offline
Registered User
 
Join Date: Nov 2009
Location: Fairbanks, AK
Posts: 6
linuxfedorafirefox
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.
Reply With Quote
  #6  
Old 3rd November 2009, 05:12 AM
marcrblevins Offline
Registered User
 
Join Date: Jun 2006
Location: Texas
Age: 46
Posts: 4,167
linuxfedorafirefox
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.
Reply With Quote
  #7  
Old 3rd November 2009, 07:07 AM
Lonny Offline
Registered User
 
Join Date: Nov 2009
Location: Fairbanks, AK
Posts: 6
linuxfedorafirefox
thank you Marc. Perciate it
Reply With Quote
  #8  
Old 15th June 2010, 04:21 PM
teknikqa Offline
Registered User
 
Join Date: Mar 2010
Posts: 1
linuxfedorafirefox
Re: Forbidden when changind documentRoot path in httpd.conf

Thanks Marc.. Just what I was looking for...
Reply With Quote
  #9  
Old 25th March 2014, 07:40 AM
flebber Offline
Registered User
 
Join Date: Mar 2005
Location: Newcastle, Australia
Posts: 230
linuxchrome
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.
Reply With Quote
  #10  
Old 25th March 2014, 11:18 AM
flebber Offline
Registered User
 
Join Date: Mar 2005
Location: Newcastle, Australia
Posts: 230
linuxchrome
Re: Forbidden when changind documentRoot path in httpd.conf

Oh I forgot to edit the userdir.conf
Reply With Quote
Reply

Tags
changind, documentroot, forbidden, httpdconf, path

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /us Kingtu Servers & Networking 2 5th April 2007 12:54 AM
ci problems with /etc/httpd/conf/httpd.conf lonelylost_brar Servers & Networking 2 8th June 2005 08:17 PM


Current GMT-time: 01:35 (Sunday, 24-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat