Static Website Hosting
How a Static Website Works and Why It Is Simple
Static website hosting is a way of serving websites made of fixed files: HTML pages, CSS stylesheets, images and JavaScript that runs in the visitor's browser. The server does not build a page for each visitor, so the host only needs to send files that already exist.
A dynamic site works differently. When someone opens a page, a program on the server, often written in PHP or Python, assembles it from data stored in a database, an organised store of information. That requires a more complex server environment. A static site skips both steps, which makes it lighter on resources and gives attackers less software to target.
Many static sites are created with a static site generator, a tool that turns templates and text files into finished HTML pages before upload. The generator runs on the author's computer or a build service, and the host receives only the final files.
Trade-Offs to Weigh Before Choosing Static Hosting
Static hosting is efficient, but it does not suit every site. The main trade-offs are:
- No built-in dynamic features: Search, comment sections, contact forms and user logins need a third-party service or a small piece of code that runs only when called, known as a serverless function.
- Updates require a rebuild: Changing one sentence may mean regenerating the site and uploading the files again, unless a content tool does this for you.
- Limited server control: You generally cannot run custom server software or server-side code, so unusual requirements may rule this approach out.
For how static hosting compares with other plan types, see the overview of hosting types.
A Photography Portfolio Built as Static Files
A freelance photographer builds a portfolio of about twenty pages, each with images and a short description. She writes the text in simple files, runs a generator on her laptop and uploads the resulting folder to a static host. The site has no login, no database and no visitor-submitted content, which suits its purpose well.
Frequently asked questions
Can You Host a Static Website for Free?
Yes, some services offer free hosting for static files, but the terms vary. Free plans often limit storage, bandwidth and custom domain names, and some restrict commercial use. Read the terms before relying on one for a business site. The guide to free web hosting limits explains the common catches.
Is Static Hosting the Same as Shared Hosting?
No. Shared hosting provides a full server environment, usually with support for PHP, databases and server-side software, and runs many customers' accounts on one machine. Static hosting only delivers files that already exist. A static site can run on a shared plan, but most of what a shared plan offers would go unused.