1

I have a Laravel project on my CentOS7 server which sits on the folder "/var/www/html/myProject".

I have changed my document root in /etc/httpd/conf/httpd.conf to "/var/www/html/myProject/public" both in "DocumentRoot" and in the directory configure so when i enter the IP in the browser it will automatically show the project.

When i try to do so and access my IP through the browser i am greeted with the messages:

Forbidden You don't have permission to access /form on this server. Server unable to read htaccess file, denying access to be safe

After further examination i have found out that in my /var/log/httpd/error_log i get the following error after every access attempt:

[Thu May 10 19:39:33.683522 2018] [core:crit] [pid 1994] (13)Permission denied: [client 79.182.62.1:51091] AH00529: /var/www/html/myProject/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/html/myProject/' is executable

That was very odd to me since the path is supposed to be /var/www/html/myProject/public, but the "public" is missing.

I have restarted my apache several times, and changed the DocumentRoot path to a fictional path just to check if it updates and it is.

Could it maybe be something in the .htaccess file? although i didn't change the file, i left it as Laravel created it.

3
  • I do not think it is permissions...have you created a Unix user called MyProject? Commented May 11, 2018 at 7:45
  • No. the user owning the directory is apahce
    – shay k
    Commented May 11, 2018 at 8:12
  • To inspect recent SELinux errors in detail, see here. Alternatively, to check for bad SELinux labels inside the DocumentRoot, use e.g. restorecon -n -Rv /var/www. (To fix, remove the -n).
    – sourcejedi
    Commented May 11, 2018 at 8:28

1 Answer 1

1

This could either because of the Permissions on the public file. For now just give full permissions and see what it does

chmod 0777 /var/www/html/myProject/public

or

chmod -R 0777 /var/www/html/myProject

If still the page is inaccessible check the SElinux status on your host machine.

Type sestatus and check the current mode. It should either be disabled or in permissive mode. If its in enforcing mode then httpd web page may not display the contents as expected.

To set SElinux to permissive mode type the following command:

setenforce 0
8
  • 2
    Your recommendation is very unsecure! Commented May 11, 2018 at 7:45
  • Well its just the permission changes for now considering the fact the creator hasnt mentioned anything about security concerns. If so then permissions can be tweaked. Not a big deal
    – Zorrom
    Commented May 11, 2018 at 7:48
  • 1
    @Zorrom Both recommendations are poor advice. Commented May 11, 2018 at 7:50
  • @Zorrom "for now" does not make for a good answer to a question. When you have enough "reputation" from other contributions, the site will let you post comments to request e.g. troubleshooting steps from the asker. unix.stackexchange.com/help/privileges/comment
    – sourcejedi
    Commented May 11, 2018 at 8:14
  • 1
    @Zorrom Usually you tell selinux what is the DocumentRoot, better than disabling it. Havent got time now to explain it better. Commented May 11, 2018 at 10:31

Not the answer you're looking for? Browse other questions tagged .