Settings

Theme

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

1 points by zen_boy 12 years ago · 5 comments · 1 min read


Front-end and back-end are separating. I find myself writing more web apps that either don't require a backend or outsource it to backend as a service (Baas).

It seems a bit silly to have to deploy and maintain hosted servers with Nginx just to serve static files. Preferably, I'm looking for a managed and "one command" distributed solution with uptime guarantees, something like Heroku, but for websites consisting of static files only.

I heard people were using S3 for this, but then recall reading that S3 wasn't recommended to host websites.

How do you guys host these files? Also, how do you deal with SSL and canonical URLs (no-www)?

Thank you.

jrmenon 12 years ago

Shouldn'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.

If you are using apache, you can use the following directive, EnableSendFile:

http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfil...

Essentially it exploits the sendifle() sys. call results in transmitting files via the kernel.

Nginx should have the equivalent too.

Also look into related http settings like 'Expires' header to ensure it is set far into the future - i.e. maximizing caching on the client side. See more details here:

http://developer.yahoo.com/performance/rules.html

donavanm 12 years ago

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.

  • zen_boyOP 12 years ago

    How do you deal with something like SSL and canonical URLs with SEO in mind?

    Thanks!

jjaredsimpson 12 years ago

Seems like Amazon recommends it in the documentation.

  • petercooper 12 years ago

    Yesh, use S3. They did used to recommend against this but have recently added features to make it easier and have changed their tune.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection