首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Apache错误:没有匹配的DirectoryIndex

Apache错误:没有匹配的DirectoryIndex
EN

Stack Overflow用户
提问于 2016-05-04 02:58:40
回答 2查看 18.5K关注 0票数 1

这是我第一次尝试在我的共享主机账户上部署我的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

当我转到我的子域url时,我得到的是:

我已经检查了我的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

希望有谁能帮我。谢谢!

EN

回答 2

Stack Overflow用户

发布于 2019-12-17 15:54:15

也许现在回答已经晚了,但请确保您对您的public/index.php文件具有正确的权限。例如,如果您的用户是核心,那么您也应该将其设置为index.php的所有者。

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

sudo chown -R core public/index.php

票数 1
EN

Stack Overflow用户

发布于 2016-05-04 04:03:21

您可以尝试在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,您的应用程序应该会按预期工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37012303

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档