Shutterstock/marketinggraphics

You’ve probably heard the term “static content” thrown around—it applies to certain types of websites and files, and depending on the type of website you’re running, it can have a huge effect on how you’re able to host that site.

Static vs. Dynamic Content

“Static content” applies to files that don’t change. They’re stored as files on disk and served directly to the users of your website. For example, CSS stylesheets are static content; they can be hosted as a file download, and they’re the same for each user.

This doesn’t mean static content can’t offer interactive websites. JavaScript files are static content, and they don’t execute any code until they reach a user’s browser. Using JavaScript frameworks like ReactJS, you can have interactive web apps without any server-side processing. The files for React are just JavaScript bundle files, HTML, and CSS—regular website things.

Dynamic content, on the other hand, is created for each unique user. It’s important to understand the distinction on where this happens. Dynamic content is specifically created on the server side, usually by making a database request and updating the page before it is sent to the user. As far as the user knows, they’re just getting a web page. The never see the database.

WordPress is a famous example of dynamic content, and it’s what you’re reading this on right now. For each request for an article, WordPress will talk to a MySQL database and fetch the page info. That info might get cached for performance, but it’s still dynamic content.

The key takeaway is that this requires CPU processing on the web server. Websites using tools like PHP, Ruby on Rails, or Django all execute on the server. Every request uses extra CPU power, and there must always be a server like this to handle talking to the database.

On the other hand, you can have “static content” that achieves largely the same effect. In this example, the processing is done client-side.

This can still be “dynamic” in the sense that it can respond to inputs, update pages and components, and serve interactive web applications, but all processing is done by the user’s browser.

Generally, if you want to connect this to a database, you’d want to set up an API—a web server that responds to requests in a JSON format that the browser application can load. In that case, this API web server would be serving dynamic JSON content.

Benefits of Static Content Hosting

Traditionally, if you want to host a website, you’ll need to set up a web server to process requests. However, if you’re only serving static content, there isn’t much your web server actually has to do. In fact, all you’d be doing is setting up a service like NGINX to serve those static files over HTTPS.

This is an easy task to do, and many cloud services offer solutions for hosting files without configuring your own servers. This can cut down on costs tremendously, leaving you to only pay for data. It’s also very easy to scale up, since if you host on a platform like AWS, your website is never going to go down because of too much traffic.

Static content can be hosted from cloud storage solutions like AWS’s Simple Storage Service (S3). You simply upload the files to the storage bucket, configure it for hosting, and it’s available from the internet.

bucket contents

While this is a simple setup, it’s actually a decent enterprise-grade solution for hosting websites. If your website doesn’t use dynamic content, you will want to prioritize using a solution like this instead of hosting your own web servers, especially if you’re on a cloud provider like AWS.

Profile Photo for Anthony Heddings Anthony Heddings
Anthony Heddings is the resident cloud engineer for LifeSavvy Media, a technical writer, programmer, and an expert at Amazon's AWS platform. He's written hundreds of articles for How-To Geek and CloudSavvy IT that have been read millions of times.
Read Full Bio »