繁体   English   中英

Apache 错误:没有匹配的 DirectoryIndex

[英]Apache Error: No matching DirectoryIndex

这是我第一次尝试在我的共享主机帐户上部署我的Laravel应用程序。

文件夹结构如下:

|--laravel
  |--app
     |--GoPublic.php // use to point to new location 
  |--bootstrap
  |--config
  |--database
  // more folders 
|--public_html
  |--app // my subdomain document root
     |--assets
     |--index.php // GoPublic.php point to this file

当我转到我的子域网址时,我得到以下信息:

在此处输入图片说明 我检查了我的 error.log 文件,我收到以下 403 禁止错误:

[autoindex:error] [pid 910782] [] AH01276: Cannot serve directory /home/user/public_html/app/: No matching DirectoryIndex (index.php,Index.html,Index.htm,index.html.var,index.htm,index.html,index.shtml,index.xhtml,index.wml,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.php4,index.php3,index.phtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html) found, and server-generated directory index forbidden by Options directive

希望任何人都可以帮助我。 谢谢!

也许回答晚了,但请确保您对public/index.php文件拥有正确的权限。 例如,如果您的用户是core ,您也应该将其设置为index.php的所有者。

要更改它,您可以使用以下命令:

sudo chown -R core public/index.php

可以尝试在laraval目录和laravel/public目录下添加.htaccess

<IfModule mod_rewrite.c>
WriteEngine On
RewriteBase /laravel/public/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

也许您还需要将 Laravel 指向公共目录才能使其工作。 例如,如果你已经在/path_to_laravel/public/目录中安装了 Laravel,你需要在你的 Apache 配置中使用这些设置:

DocumentRoot "/path_to_laravel/public/"
<Directory "/path_to_laravel/public/">

之后重新启动 Apache,您的应用程序应该可以正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM