我在那里,在我的本地主机上有我的文件之前,我能够很好地为他们服务.现在,我将我的静态文件移动到S3,但我想使用自定义域提供index.html启动文件.从index.html必须可以导航到其他.html.
到目前为止我得到了:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include snippets/letsencrypt.conf;
include snippets/ssl-params.conf;
charset utf-8;
server_name mydomain;
location / {
proxy_set_header Host 's3-eu-west-1.amazonaws.com';
proxy_set_header Authorization '';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
proxy_intercept_errors on;
set $indexfile "s3-eu-west-1.amazonaws.com/myprod-bucket/static/js/frontend/build_v0.5/";
proxy_pass https://$indexfile;
# expires 1y;
log_not_found off;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd_finder;
}
}
Run Code Online (Sandbox Code Playgroud)
我似乎找不到任何适合我案例的例子,我做错了什么?
更新:我根据/sf/answers/1599063091/改变了一下,我开始得到:
Refused to execute script from '../vendor.5ad3d736.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
和
Resource interpreted as Stylesheet but transferred with MIME type text/html: "../styles/main.b812e04a.css".
在代理场景中,内容类型由源服务器(本例中为 S3)指定,除非被覆盖。您可以在上传 S3 对象时指定它们的 MIME 类型。如果您通过 S3 Web 界面执行此操作,请确保不要取消选中“自动找出内容类型”。除非另有说明,AWS cli 工具还会自动猜测 mime 类型。如果您使用其他工具上传文件,则需要查阅相应工具的手册/API参考。
您还可以直接从 S3 为您的网站提供服务,请参阅在 Amazon S3 上托管静态网站
| 归档时间: |
|
| 查看次数: |
967 次 |
| 最近记录: |