--- title: "Host a static website" description: "Serve a static site's HTML, CSS, and client-side files straight from a public E2E Object Storage bucket." content_type: "how-to" product: "object-storage" platform: "MyAccount" url: "/myaccount/object-storage/how-to/host-a-static-website/" topic: ["use-with-other-products"] relationships: {"requires":["/myaccount/object-storage/how-to/create-a-bucket/","/myaccount/object-storage/how-to/make-a-bucket-public/"]} --- # Host a static website A static site (HTML, CSS, images, and client-side scripts, with no server-side code like PHP or a Node backend) can be served straight out of a bucket, once its objects are reachable over the internet. A static site on E2E Object Storage is a bucket with Public Access turned on and your site's files uploaded to it, each reached by its object URL. ## Create the bucket and upload your site [Create a bucket](/myaccount/object-storage/how-to/create-a-bucket/), then [upload](/myaccount/object-storage/how-to/upload-and-download-objects/) your site's files to it, keeping the same folder structure your site expects. ## Make the website reachable Turning on **Download** opens every file in the bucket to anyone who has its address, so keep only the site's own files in this bucket. Open the bucket's **Permissions** tab, click **Public Access Config**, check **Download**, and click **Save Permission**. Anyone can now retrieve a file by its object URL. Each file is reachable at `https://objectstore.e2enetworks.net//`, or the equivalent Chennai address from [S3 compatibility](/myaccount/object-storage/concepts/s3-compatibility/) if that is where your bucket is. ## Check the site in a browser Open your home page's address in a private browser window: the address from [Make it reachable](#make-the-website-reachable), with your home page's file name as the file path. The page loads with its styles and images. A file that fails to load usually has a different path in the bucket from the one the page asks for; check the folder structure you uploaded. ## (Optional) Add a CDN A CDN serves your site's files from edge locations around the world, so visitors far from your bucket's region get them from a location near them. Your account must have CDN turned on first; see [Request CDN](/myaccount/cdn/how-to/request-cdn/). 1. In the bucket's **Permissions** tab, click **Public Access Config**, check **Listing** as well as **Download**, and click **Save Permission**. **Add to CDN** needs both; with **Download** alone, you get **Public Access Required**. 2. In the bucket's **Actions** menu, choose **Add to CDN**. 3. **Origin Domain Name** is filled in with your bucket's address and cannot be changed. 4. Leave **Origin path** empty to serve the whole bucket. The bucket's name is already part of **Origin Domain Name**, so entering `/` makes the CDN look for a folder of that name inside the bucket, and your files get an HTTP 404 error. 5. **Origin ID** fills in for you; keep it as it is. 6. Click **Create CDN**. **Create CDN** creates a distribution for your bucket, which serves your files at its own address, its Distribution URL. A new distribution can take up to 30 minutes to deploy. It shows **InProgress** while it deploys, then **Deployed**. It also shows **Enabled** or **Disabled**: **Enabled** means it serves requests. Once the CDN is attached, the bucket gets a **Bucket CDN** tab of its own in its detail panel. For each step and how to find a file's CDN address, see [Serve a bucket through the CDN](/myaccount/cdn/how-to/serve-a-bucket-through-the-cdn/). Once the distribution is created, set **Default Root object** to your home page's file name, such as index.html, so that your home page loads at the Distribution URL's root address. A new distribution has none. See [Change the basic settings](/myaccount/cdn/how-to/change-distribution-settings/#change-the-basic-settings). **Add to CDN** needs **Listing**, which lets anyone see the names of all the files in the bucket. To keep the names private once the distribution is created, open the bucket's **Permissions** tab, click **Public Access Config**, clear **Listing**, keep **Download** checked, and click **Save Permission**. Your site keeps loading through the CDN. If the CDN served the list before you closed it, clear the cache for the path `/` with **Flush Cache** on the distribution's **Invalidations** tab; see [Serve a bucket through the CDN](/myaccount/cdn/how-to/serve-a-bucket-through-the-cdn/#close-the-buckets-file-list). A bucket's distribution always uses the E2E certificate, so it serves your site at its Distribution URL, not at a domain name of your own. ## Update your site once the CDN is live The CDN caches your files, so a new version of a file you upload to the bucket reaches visitors once the cached copy expires. To serve the new version sooner, clear the cache for the paths you changed: in MyAccount, under **Network**, click **CDN**, click the distribution on **Manage CDN Services**, open its **Invalidations** tab, and click **Flush Cache**. See [Clear the cache](/myaccount/cdn/how-to/clear-the-cache/). To update the site, upload the changed files over the old ones. For what public access opens up and how to close it again, see [Make a bucket public](/myaccount/object-storage/how-to/make-a-bucket-public/).