[英]Configure Laravel on a subdomain with Nginx on Elastic Beanstalk
My Laravel application runs locally and remotely on the main domain ( https://www.example.com and https://example.com ), but my staging environment doesn't work. 主页有效,但其他路线无效(我得到 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添加到此配置?
由于您使用的是 Amazon Linux 2 (AL2),这可以解释为什么不使用您的 nginx 配置文件。
具体来说,在 AL2 平台上,nginx 配置文件应设置在.platform/nginx/conf.d/
中,而不是.ebextensions
中。 .ebextentions
设置,但在 AL2 中没有。
因此,您可以尝试使用以下内容创建文件.platform/nginx/conf.d/myconf.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;
}
}
请注意,我无法验证 nginx 配置文件是否正确。 这只是基于你的问题。 它也可能有错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.