简体   繁体   English

通过Rails从S3服务静态网站

[英]Serving static websites from S3 through Rails

I am trying to create a rails app that will run on my main domain, which will have a bunch of subdomains that will all be separate static websites. 我正在尝试创建将在我的主域上运行的Rails应用程序,该主域将具有一堆子域,它们都是独立的静态网站。

I want the files for these static sites to each be in their own folder on an S3 bucket I created. 我希望这些静态站点的文件都位于我创建的S3存储桶中的自己的文件夹中。 So, going to mysite.example.com you would see the index.html file in the mysite folder on S3. 因此,转到mysite.example.com,您将在S3的mysite文件夹中看到index.html文件。 The user's browser would also have to be able to pull any of the CSS and images referenced in index.html 用户的浏览器还必须能够提取index.html中引用的任何CSS和图像

Is there any way to do this? 有什么办法吗? If possible I would like to do this off of Heroku, but that might not be feasible. 如果可能的话,我想在Heroku上进行此操作,但这可能不可行。

The right_aws gem might be exactly what you're looking for; right_aws宝石可能正是您在寻找的东西; it claims to offer S3 and EC2 support, among other services. 它声称将提供S3和EC2支持以及其他服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM