我在谷歌云存储桶中托管VueJS,只有在使用域名而没有子路径时,应用程序才能工作:www.domain.com当使用URL:www.domain.com/sub/path时,我得到了404错误,因为看起来NGINX正在桶中寻找这条路径,而不是让VueJS路由器接管。我试图跟随老的线程,但在我的例子中没有帮助。
有什么办法解决这个问题吗?
location = / {
proxy_pass https://gcs/mygoogle-cloud-bucket/main.html;
proxy_set_header Host storage.googleapis.com;
}
location / {
rewrite /(.*) /$1 break;
proxy_pass https://gcs/mygoogle-cloud-bucket/$1$is_args$args;
proxy_redirect off;
index main.html;
proxy_set_header Host storage.googleapis.com;
}发布于 2022-05-11 23:49:13
您需要做的似乎是使用Cloud和VueJS创建一个VueJS。
在这种情况下,有几件事需要澄清:
这应该能让你用上你的网站。如果您想检查一个工作示例,可以查看这一个。
您的代码应该类似于:
location / {
rewrite /$ $uri$index_name;
proxy_set_header Host storage.googleapis.com;
proxy_pass https://gs/$bucket_name$uri;
proxy_http_version 1.1;
proxy_set_header Connection "";
}https://stackoverflow.com/questions/72203504
复制相似问题