TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How to host websites consisting of static files only?

1 点作者 zen_boy超过 11 年前
Front-end and back-end are separating. I find myself writing more web apps that either don&#x27;t require a backend or outsource it to backend as a service (Baas).<p>It seems a bit silly to have to deploy and maintain hosted servers with Nginx just to serve static files. Preferably, I&#x27;m looking for a managed and &quot;one command&quot; distributed solution with uptime guarantees, something like Heroku, but for websites consisting of static files only.<p>I heard people were using S3 for this, but then recall reading that S3 wasn&#x27;t recommended to host websites.<p>How do you guys host these files? Also, how do you deal with SSL and canonical URLs (no-www)?<p>Thank you.

3 条评论

jrmenon超过 11 年前
Shouldn&#x27;t be hard to setup a few instances (based on your traffic profile) to host the static files esp. in conjunction with a CDN like Cloudfront.<p>If you are using apache, you can use the following directive, EnableSendFile:<p><a href="http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile" rel="nofollow">http:&#x2F;&#x2F;httpd.apache.org&#x2F;docs&#x2F;2.2&#x2F;mod&#x2F;core.html#enablesendfil...</a><p>Essentially it exploits the sendifle() sys. call results in transmitting files via the kernel.<p>Nginx should have the equivalent too.<p>Also look into related http settings like &#x27;Expires&#x27; header to ensure it is set far into the future - i.e. maximizing caching on the client side. See more details here:<p><a href="http://developer.yahoo.com/performance/rules.html" rel="nofollow">http:&#x2F;&#x2F;developer.yahoo.com&#x2F;performance&#x2F;rules.html</a>
donavanm超过 11 年前
Use S3, and their website feature if youd like. If you expect moderate traffic use CloudFront. The CloudFront data transfer rates are cheaper than S3, IIRC.
评论 #6346209 未加载
jjaredsimpson超过 11 年前
Seems like Amazon recommends it in the documentation.
评论 #6346063 未加载