--- title: "Create a distribution" description: "Create an E2E CDN distribution for your own web server in MyAccount, choose a CDN plan the first time, and serve files at your own domain name." content_type: "how-to" product: "cdn" platform: "MyAccount" url: "/myaccount/cdn/how-to/create-a-distribution/" relationships: {"requires":["/myaccount/cdn/how-to/request-cdn/"]} --- # Create a distribution A distribution serves the files on your origin, such as your web server at `static.example.com`, from edge locations around the world, at an address of its own. You create it once, and the CDN then fetches each file from your origin only when an edge location has no fresh copy. To serve a bucket in E2E Object Storage, use **Add to CDN** on the bucket instead, which fills in the origin for you. See [Serve a bucket through the CDN](/myaccount/cdn/how-to/serve-a-bucket-through-the-cdn/). ## Before you begin - CDN is on for your account: **Create CDN** shows on **Manage CDN Services**. If **Request CDN** shows instead, see [Request CDN](/myaccount/cdn/how-to/request-cdn/). - Your origin is reached by a domain name, such as `static.example.com`. It can be a server at E2E or anywhere else, and it can belong to another E2E account. - Anyone can read the files you will serve from the origin, with no sign-in. - Your origin serves HTTPS with a certificate that is valid for its domain name. Every new distribution starts with **Origin Protocol Policy** set to **HTTPS only**, so the CDN connects to your origin over HTTPS. If the origin's certificate is not valid for its name, visitors get an HTTP 502 error. If your origin serves only HTTP, set **Origin Protocol Policy** to **HTTP only** once the distribution is created; see [How the CDN connects to your origin](/myaccount/cdn/how-to/change-distribution-settings/#how-the-cdn-connects-to-your-origin). - To serve files at your own domain name, such as `cdn.example.com`, you have a certificate for it in **SSL Certificates** in MyAccount. See [Serve files at your own domain name](#optional-serve-files-at-your-own-domain-name). A project can have one distribution for each origin domain name. A distribution belongs to the project you create it in. Distributions show the same whether you have Delhi or Chennai selected. ## Choose a CDN plan the first time The first time you click **Create CDN** while your account has no CDN plan, **Select CDN plan** opens before the create form. You choose the plan once, for the whole account. 1. In MyAccount, under **Network**, click **CDN**. **Manage CDN Services** opens. 2. Click **Create CDN**. **Select CDN plan** opens. 3. In **Choose a Plan**, pick a plan. The list shows each plan's monthly price, with the 250 GB plan selected. Choose the plan whose monthly bandwidth is closest to what you expect to serve. 4. Read the warning on the page, which says that: - The plan's price is billed each calendar month as the full cost, or deducted from infra credits on a prepaid account. - The plan renews on the first day of every month until you change it. - Bandwidth beyond the plan is charged per GB. - The plan cannot be changed in the month it takes effect. - A discount or coupon may not apply. 5. Check **I understand and want to create CDN with a selected CDN plan.** **Next** is available once it is checked. 6. Click **Next**. MyAccount saves the plan and opens **Create CDN**. On a prepaid account without enough infra credits for the plan's price, **Next** opens a low balance dialog. Buy more infra credits, or ask your MyAccount administrator to, and then click **Next** again. For prices, see [E2E's pricing page](https://www.e2enetworks.com/pricing). Once your account has a plan, **Create CDN** opens the create form directly. To change the plan later, see [Change your CDN plan](/myaccount/cdn/how-to/change-your-cdn-plan/). ## Fill in the origin On **Manage CDN Services**, click **Create CDN**. On the **Create CDN** page: 1. In **Origin Domain Name**, enter the domain name of the server the CDN fetches your files from, such as `static.example.com`. Enter the name only, with no `https://` and no path. An IP address is refused when you create the distribution. 2. (Optional) In **Origin path**, enter a folder at the origin to serve from, such as `/static`. Start it with `/`, and leave no `/` at the end. A path in another shape, such as `static/`, is refused when you create the distribution. The CDN adds the path in front of every file path it asks your origin for. Leave it empty to serve everything on the origin. 3. Check **Origin ID**. It fills in with the **Origin Domain Name** as you type one, and it is required. Keep it as it is filled in. With **Origin path** set to `/static`, a visitor who asks for `https:///logo.png` gets the file at `static.example.com/static/logo.png`. If the file is not in that folder on your origin, the visitor gets your origin's not-found answer. **Origin Domain Name** reads **Origin/Domain name is required.** when it is empty, and **DNS name you have specified is not valid.** when the value is not a domain name. ## Choose the certificate **SSL Certificate** sets the address visitors use to reach your files: - **Default SSL Certificate (\*.e2enetworks.net)**, selected to start, serves your files at the distribution's own address, its Distribution URL. Visitors' browsers must support TLSv1 or later. Take this one unless you need your own domain name. - **Custom Certificate (example.com)** serves your files at your own domain name. See the next section. ## (Optional) Serve files at your own domain name To serve files at a name of your own, such as `cdn.example.com`, the origin must be on the same domain, such as `origin.example.com`, and you need a certificate for that domain in **SSL Certificates**. A wildcard certificate such as `*.example.com` covers both names. The certificate must be issued by a certificate authority that browsers trust; a certificate signed by any other authority is refused when you create the distribution. 1. Under **SSL Certificate**, choose **Custom Certificate (example.com)**. 2. In **Domain Names(CNAMEs)**, enter the names visitors will use, such as `cdn.example.com`, separated by commas or one on each line. 3. In **Select Certificate**, choose the certificate. If you do not have one yet, click **Buy or Import SSL Certificate**, which opens **SSL Certificates** in a new tab. Once it is there, choose it here. Every name you list must be on the same domain as the origin. These messages tell you what to change: - **CNAMEs are required.**: enter at least one name. - **Origin and CNAMEs should have the same domain name.**: change the names, or the origin, so they share one domain. - A message about the certificate's Subject Alternative Name (SAN): the certificate does not cover the origin domain name or a name you listed. With a wildcard certificate such as `*.example.com`, the origin domain name and every name must end in `example.com`. For the exact messages, see [Origin and CNAMEs should have the same domain name](/myaccount/cdn/troubleshooting/cdn/#origin-and-cnames-should-have-the-same-domain-name). ## Create the distribution Click **Create Distribution**. It is available once the required fields are valid. **Manage CDN Services** opens again with **Your Distribution has been created successfully. It will take upto 30 minutes to deploy. Please wait.** A second distribution for the same origin domain name in the project is refused with **Domain already exists for this user.** See [Domain already exists for this user](/myaccount/cdn/troubleshooting/cdn/#domain-already-exists-for-this-user). ## The settings a new distribution starts with Every new distribution starts with these settings. You can change each one after it is created; see [Change distribution settings](/myaccount/cdn/how-to/change-distribution-settings/). | Setting | Starts at | | ----------------------------- | -------------------------- | | **Origin Protocol Policy** | HTTPS only | | **Origin SSL Protocol** | TLSv1.2 | | **Origin Response Timeout** | 30 seconds | | **Origin Connection Timeout** | 5 seconds | | **Viewer Protocol Policy** | HTTPS Only | | **Allowed HTTP Method** | GET, HEAD | | **Minimum TTL** | 0 seconds | | **Maximum TTL** | 3153000 seconds | | **Default TTL** | 86400 seconds, one day | | **Supported HTTP Versions** | HTTP/2, HTTP/1.1, HTTP/1.0 | | **Default Root object** | None | ## Check that the distribution is live On **Manage CDN Services**, your distribution shows **InProgress** and **Disabled** while it deploys to the edge locations. This takes up to 30 minutes, and the page can show the change up to 15 minutes after that. When it shows **Deployed** and **Enabled**, it is serving files. With the default certificate, copy the address under **Distribution URL**. It is the first part of your origin domain name, followed by 10 random letters and digits. Then ask for a file through it: ```bash curl -I https:/// ``` Replace `` with the address you copied, and `` with a file's path on your origin. The status `200` on the first line of the output means the CDN served the file. Distributions answer over IPv4. With the default certificate, your files are now served through the CDN at the Distribution URL. Put that address in your site's pages wherever they link to these files. To tune how long files stay cached, see [Change distribution settings](/myaccount/cdn/how-to/change-distribution-settings/). For help when the create fails or a file does not load, see [Troubleshooting CDN](/myaccount/cdn/troubleshooting/cdn/).