If I paste the code from a file into index.html and try to access it from browser is working BUT if I try to transfer the file with WinSCP into /var/www/html directory I get "403 Forbidden; You don't have permission to access". I also tried to copy the file with root login or a user made without root access + chown the /var/www/html directory to root, apache, nothing worked. What could be the problem?

  • 1
    In general on CentOS: SELinux security contexts. Try for instance restorecon -R /var/www/html/ – HBruijn Jun 8 '18 at 8:07
  • It worked! thanks, can u please reply as an answer so I can mark as the solution for this problem. – itarachiu Jun 8 '18 at 8:19

Frequently such problems find their origin in SELinux security context violations.

Try for instance restorecon -R /var/www/html/

| improve this answer | |

Edit /etc/httpd/conf/httpd.conf file. Add the below code.

<Directory "path">
  #Options FollowSymLinks
  Options Indexes FollowSymLinks Includes ExecCGI
  AllowOverride None
  Allow from all

Then, restart httpd.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.