【问题标题】:After installation - "Sorry, the page you are looking for could not be found"安装后-“抱歉,找不到您要查找的页面”
【发布时间】:2019-05-19 01:17:00
【问题描述】:

我在运行 Debian 9.6 和 Apache 的服务器上安装了 Laravel。

我在我的站点等name.com 的文件夹之一中运行命令composer create-project laravel/laravel api 5.5.*。我想通过 URL 访问它:https://name.com/api/public - 但我在全新安装时遇到错误说:

抱歉,找不到您要查找的页面。

我也尝试使用php artisan serve --host=0.0.0.0 运行它,但它显示相同的页面。

在我发现的日志中:

[2018 年 12 月 18 日星期二 16:15:30.818500] [autoindex:error] [pid 2334] [client 81.2.249.13:36972] AH01276:无法提供目录 /var/www/name/www/:没有匹配的 DirectoryIndex( index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) 找到,并且服务器生成的目录索引被选项指令禁止

我尝试了很多东西,我在这里或在谷歌上找到了,但没有任何帮助。

澄清一下:我有域 - http://example.com 并在该域的目录 /var/www/example/www/ 我创建了目录 api/ 位于 Laravel 新安装的位置 - 我正在访问这个来自 www.example.com/api/

.htaac​​ess 文件:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews +Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

感谢您的建议。

【问题讨论】:

  • 您是name.com 域的所有者吗?您是否使用要使用的 IP 地址(可能是 127.0.0.1)创建了相应的 DNS 条目?
  • 该域名 - 仅用于示例,是的,我是我正在使用的域名的所有者。
  • 你确定 /api/public 是一个有效的 URI 吗?在全新安装时,如果您的网络服务器设置正确,您不应该尝试获取特定的 uri。
  • 我对我的问题添加了一些解释 - 这就是我访问 /api/public 的原因
  • 你是在服务器上使用 nginx 还是 apache?

标签: php laravel apache laravel-5 debian


【解决方案1】:

请插入下面的命令并尝试访问。

setenforce 0

它对我有用。

另外,你可以从here完美安装laravel

【讨论】:

    猜你喜欢
    • 2018-04-22
    • 2017-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-15
    • 2017-01-07
    • 1970-01-01
    相关资源
    最近更新 更多