【发布时间】:2020-11-10 01:16:12
【问题描述】:
我的 Laravel 应用程序在主域(https://www.example.com 和 https://example.com)上本地和远程运行,但我的暂存环境不起作用。主页有效,但其他路线无效(我收到 504)。
我使用的 nginx.conf 如下:
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
if ($http_x_forwarded_proto = 'http'){
return 301 https://$host$request_uri;
}
}
如何将https://staging.example.com 添加到此配置中?
【问题讨论】:
-
你是如何使用
.ebextentions设置nginx的?您还使用基于 Amazon Linux 1 或 2 的 EB 平台吗? -
@Marcin 是的,.ebextensions。 Linux 2.
-
嗨。暂存环境是单独的EB环境吗?是单实例环境还是负载均衡环境?
-
负载平衡和第二个 EB 环境(从生产中克隆)。
-
如果它的负载平衡环境,从 http 到 https 的重定向应该在您的 ALB 上完成。 SSL 证书应部署在 ALB 上。并且域
staging.example.com是使用Route53 设置的?如果您使用负载平衡环境,我不确定您为什么要使用 nginx 将 http 重定向到 https?
标签: laravel nginx amazon-elastic-beanstalk