[英]httpd not reading the document root in conf/httpd.conf as expected
I have a Laravel project on my CentOS7 server which sits on the folder "/var/www/html/myProject". 我的CentOS7服务器上有一个Laravel项目,该项目位于文件夹“ / 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. 我已将/etc/httpd/conf/httpd.conf中的文档根目录更改为“ DocumentRoot”和目录配置中的“ / var / www / html / myProject / public”,因此当我在浏览器中输入IP时将自动显示该项目。
When i try to do so and access my IP through the browser i am greeted with the messages: 当我尝试这样做并通过浏览器访问我的IP时,我收到以下消息:
Forbidden You don't have permission to access /form on this server.
禁止您无权访问此服务器上的/ form。 Server unable to read htaccess file, denying access to be safe
服务器无法读取htaccess文件,拒绝访问是安全的
After further examination i have found out that in my /var/log/httpd/error_log i get the following error after every access attempt: 经过进一步检查,我发现在我的/ var / log / httpd / error_log中,每次访问尝试后都出现以下错误:
[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
[2018年5月10日星期四19:39:33.683522] [core:crit] [pid 1994](13)权限被拒绝:[client 79.182.62.1:51091] AH00529:/var/www/html/myProject/.htaccess pcfg_openfile:无法检查htaccess文件,确保文件可读并且'/ var / www / html / myProject /'是可执行文件
That was very odd to me since the path is supposed to be /var/www/html/myProject/public, but the "public" is missing. 这对我来说很奇怪,因为该路径应该是/ var / www / html / myProject / public,但是缺少“ public”。
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. 我已经重新启动了几次Apache,并将DocumentRoot路径更改为虚拟路径,只是为了检查它是否已更新。
Could it maybe be something in the .htaccess file? 可能是.htaccess文件中的内容吗? although i didn't change the file, i left it as Laravel created it.
尽管我没有更改文件,但在Laravel创建文件时将其保留。
Check the permissions on /var/www/html/myProject
files & directories. 检查
/var/www/html/myProject
文件和目录的权限。 Based on the error you pasted it seems apache is attempting to read in data from your myProject
directory as directed by the .htaccess file. 根据您粘贴的错误,似乎apache试图按照.htaccess文件的指示从
myProject
目录中读取数据。 This is normal operation. 这是正常操作。
Figure out what user/group your apache is running is. 找出您的Apache正在运行的用户/组。 Then remember that your files have to be readable that user and all parent directories have to be accessible (hint: execute bit) for that user.
然后记住,该文件必须对该用户具有可读性,并且该用户必须可以访问所有父目录(提示:执行位)。
Finally check the bootstrap/cache and storage laravel directories (& subdirectories) are writeable by the apache user. 最后,检查引导程序/缓存和存储laravel目录(及子目录)是否可由apache用户写入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.