【问题标题】:Can't deploy laravel 5.6.7 project to a subdomain on a web server无法将 laravel 5.6.7 项目部署到 Web 服务器上的子域
【发布时间】:2018-08-11 18:08:38
【问题描述】:

当我尝试访问 web 服务器子域上的 laravel 应用程序时,我不断收到 500 错误。

我已将整个 laravel 项目上传到 public_html/laravel directory。文档根指向 public_html/laravel/public。

我已经为引导和存储目录添加了 755 个权限。

Laravel 版本:5.6.7,我机器上的 php 版本:7.1.11。 Web服务器php 7.0版

什么会导致这个问题? php版本的区别?

.htaccess 文件:

<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>

编辑: 现在我已将文档根目录更改为指向 public_html/laravel,当我添加 /public 时,我得到“未指定输入”错误,错误日志文件如下所示:

出现错误“无法打开主脚本:/home/user/public_html/laravel/public/index.php(没有这样的文件或目录)”

最终编辑:问题出在 php 版本上。

【问题讨论】:

  • 我之前遇到过这个问题,我只是添加了一个 # 来注释掉多视图:所以 #Options -MultiViews -Indexes 并不是说​​这是正确的方法,但它对我有用。
  • 当您看到500 Internal Server Error 消息时,Apache 服务器不仅可以提示您出现了什么问题。请将LogLevel 增加到debug 并将错误日志文件中生成的错误消息添加到问题中。
  • 感谢您的回复。我已经编辑了我的问题

标签: php laravel apache


【解决方案1】:

试试

chown -R apache:apache /home/user/public_html/laravel/

【讨论】:

  • 您应该编辑您的答案以解释它的作用以及它为什么有用。请记住,理想情况下,这将成为互联网上解决方案多年的路标。
【解决方案2】:

这是您的 PHP 版本。 Laravel 5.6 需要PHP >= 7.1.3

【讨论】:

    【解决方案3】:

    首先你应该更新php版本到PHP>=7.0,其次如果有缓存问题那么你必须运行这个命令php artisan config:cache来清除本地服务器的旧配置。我经常遇到这个问题,我希望它能帮助你和其他有同样问题的人。

    【讨论】:

      猜你喜欢
      • 2016-11-12
      • 2019-08-15
      • 2015-06-18
      • 2014-03-31
      • 2018-02-27
      • 2015-06-24
      • 1970-01-01
      • 2019-05-08
      • 1970-01-01
      相关资源
      最近更新 更多