CentOS Apache HTTPD Configuration (403 Forbidden)

243

Solution 1

You are using a stock install of CentOS, if that is correct please check that if SELinux is in Enforcing mode

getenforce

if the result is "Enforcing"

temporally change it to permissive

setenforce 0

and try again, you can also guide the condition of web content to the files in your home directory.

Solution 2

Disable SELinux or run in ROOT

setsebool -P httpd_enable_homedirs on
chcon -R -t httpd_sys_content_t /home/
chcon -R -t httpd_sys_rw_content_t /home/

Solution 3

Freaktor's answer of 'setenforce 0' did "work" for me (thanks!)

But to keep it working and re-enable SELinux, I needed to

sudo chcon -Rv --type=httpd_t /path/to/my/files

...this gave my directory and all files and directories within it the security context of "httpd_t" which is a clunky way of saying SELinux let httpd read those files.

enabling selinux again was as simple as

setenforce 1

Solution 4

You probably have a deny all somewhere in the global config. Try adding this to the vhost stanza:

<Directory /home/mcmoddr/www>
  Order allow,deny
  Allow from all
</Directory>
Share:
243

Related videos on Youtube

apony
Author by

apony

Updated on September 18, 2022

Comments

  • apony
    apony almost 2 years

    Is there any way to find venue using Foursquare API having information from user status with geotag obtained by Twitter API?

    From twitter status I've got all of the information twitter documentation but I noticed that place_id is different than venue_id in Foursquare.

    Right now the best way I can think of, to find place from tweet using Foursquare is to get from tweet: place.full_name and longitude and latitude and create a query using Foursquare API :

    https://api.foursquare.com/v2/venues/search?ll="latitude"," longitude"&query="place full name"&radius=10
    
  • Tony D
    Tony D over 12 years
    +1, Also @Spero78 should make sure no .htaccess file is in root of your vhost with restrictive directives
  • Michael Hampton
    Michael Hampton almost 12 years
    This is just temporary; any new files you make would have their original context and SELinux would still deny access to the new files. For a permanent solution, see this answer.
  • apony
    apony about 8 years
    Thank you for pointing me into the right direction, I was using tweepy and this value was always empty, even when I tried with your place id.
  • Yuri Schimke
    Yuri Schimke about 8 years
    It potentially depends on your client permissions, I had an old one lying around using the iphone client. After I re-authorising, I've now lost access to this data.
  • apony
    apony about 8 years
    Does it mean that they changed something and the vendor_info is no longer available?
  • Yuri Schimke
    Yuri Schimke about 8 years
    No, generally it means this data is only for the official apps. I used to work there so I had some old credentials lying around. There are leaked credentials around publicly, but that doesn't seem like a solid base to build on.
  • apony
    apony about 8 years
    Thank you again for your explanation.
  • The Fool
    The Fool over 4 years
    this is nothing more than a dirty hack. Its certainly not the proper way to simply disable security features. You should configure them instead.