【发布时间】:2019-11-26 15:18:57
【问题描述】:
我无法将 Laravel 5.2 应用程序从 cPanel / phpMyAdmin 迁移到 Laravel 5.8、Forge 和 AWS。
使用旧系统,我们能够让我们的用户在他们自己的品牌域以及我们平台上的子域上创建自定义子域。
例如*.theircompany.com // 这不起作用
或*.ourcompany.com // 这行得通
其中 * 是在我们平台上创建的子域。
这是通过让用户创建指向我们的根域的 CNAME 记录,并通过具有 /public_html 文档根的 cpanel 将用户域停放在我们的域列表中来实现的
我们希望对我们的用户来说尽可能简单,只使用 cname,因为现有用户会被迁移打乱。
在 Laravel 5.2 中,我相信“索引”文件是 server.php,位于 public_html 中,看起来像这样
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylorotwell@gmail.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
当我访问用户域上的子域时,我收到 404 nginx 错误。
404 Not Found
nginx/1.15.8
所以我猜这个错误是因为 nginx 配置,但我不知道如何调试。
但是,我可以看到请求正在登录/var/log/nginx/access.log:
[17/Jul/2019:17:42:40] "GET /tesrt HTTP/1.1" 404 185 "-" "Mozilla/5.0
如何使用 Laravel Forge 和 AWS 实现这一目标? Route53有必要吗?
【问题讨论】:
-
您是否在您的 nginx 服务器块中定义了 server_name 并发布了您的 /var/log/nginx/error.log
-
@MasoudHaghbin 是的 - 这就是有效的。刚刚发布了我的答案。感谢您的回复和提醒。
标签: php laravel amazon-web-services nginx