You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -15,25 +15,35 @@ You can serve static content (HTML, CSS, JavaScript, and image files) directly f
15
15
16
16
This article shows you how to enable static website hosting by using the Azure portal, the Azure CLI, or PowerShell.
17
17
18
-
<aid="portal" />
18
+
## Enable static website hosting
19
19
20
-
## [Portal](#tab/azure-portal)
20
+
Static website hosting is a feature that you have to enable on the storage account.
21
21
22
-
For a step-by-step tutorial, see [Tutorial: Host a static website on Blob Storage](https://docs.microsoft.com/azure/storage/blobs/storage-blob-static-website-host).
22
+
### [Portal](#tab/azure-portal)
23
23
24
-
After you enable static website hosting, you can view the pages of your site from a browser by using the public URL of the website.
24
+
1. Sign in to the [Azure portal](https://portal.azure.com/) to get started.
25
25
26
-
<aid="portal-find-url" />
26
+
2. Locate your storage account and display the account overview.
27
27
28
-
### Find the website URL by using the Azure portal
28
+
3. Select **Static website** to display the configuration page for static websites.
29
29
30
-
In the pane that appears beside the account overview page of your storage account, select **Static Website**. The URL of your site appears in the **Primary endpoint** field.
30
+
4. Select **Enabled** to enable static website hosting for the storage account.
5. In the **Index document name** field, specify a default index page (For example: *index.html*).
33
33
34
-
<aid="cli" />
34
+
The default index page is displayed when a user navigates to the root of your static website.
35
+
36
+
6. In the **Error document path** field, specify a default error page (For example: *404.html*).
37
+
38
+
The default error page is displayed when a user attempts to navigate to a page that does not exist in your static website.
35
39
36
-
## [Azure CLI](#tab/azure-cli)
40
+
7. Click **Save**. The Azure portal now displays your static website endpoint.
41
+
42
+

43
+
44
+
### [Azure CLI](#tab/azure-cli)
45
+
46
+
<aid="cli" />
37
47
38
48
You can enable static website hosting by using the [Azure Command-Line Interface (CLI)](https://docs.microsoft.com/cli/azure/?view=azure-cli-latest).
39
49
@@ -59,46 +69,10 @@ You can enable static website hosting by using the [Azure Command-Line Interface
59
69
60
70
* Replace the `<index-document-name>` placeholder with the name of the index document. This document is commonly "index.html".
61
71
62
-
4. Upload objects to the *$web* container from a source directory.
63
-
64
-
> [!NOTE]
65
-
> If you're using Azure Cloud Shell, make sure to add an `\` escape character when referring to the `$web` container (For example: `\$web`). If you're using a local installation of the Azure CLI, then you won't have to use the escape character.
66
-
67
-
This example assumes that you're running commands from Azure Cloud Shell session.
* Replace the `<storage-account-name>` placeholder value with the name of your storage account.
74
-
75
-
* Replace the `<source-path>` placeholder with a path to the location of the files that you want to upload.
76
-
77
-
> [!NOTE]
78
-
> If you're using a location installation of Azure CLI, then you can use the path to any location on your local computer (For example: `C:\myFolder`.
79
-
>
80
-
> If you're using Azure Cloud Shell, you'll have to reference a file share that is visible to the Cloud Shell. This location could be the file share of the Cloud share itself or an existing file share that you mount from the Cloud Shell. To learn how to do this, see [Persist files in Azure Cloud Shell](https://docs.microsoft.com/azure/cloud-shell/persisting-shell-storage).
81
-
82
-
<aid="cli-find-url" />
83
-
84
-
### Find the website URL by using the Azure CLI
85
-
86
-
You can view content from a browser by using the public URL of the website.
87
-
88
-
Find the URL by using the following command:
89
-
90
-
```azurecli-interactive
91
-
az storage account show -n <storage-account-name> -g <resource-group-name> --query "primaryEndpoints.web" --output tsv
92
-
```
93
-
94
-
* Replace the `<storage-account-name>` placeholder value with the name of your storage account.
95
-
96
-
* Replace the `<resource-group-name>` placeholder value with the name of your resource group.
72
+
### [PowerShell](#tab/azure-powershell)
97
73
98
74
<aid="powershell" />
99
75
100
-
## [PowerShell](#tab/azure-powershell)
101
-
102
76
You can enable static website hosting by using the Azure PowerShell module.
103
77
104
78
1. Open a Windows PowerShell command window.
@@ -147,28 +121,101 @@ You can enable static website hosting by using the Azure PowerShell module.
147
121
148
122
* Replace the `<index-document-name>` placeholder with the name of the index document. This document is commonly "index.html".
149
123
150
-
7. Upload objects to the *$web* container from a source directory.
* Replace the `<path-to-file>` placeholder value with the fully qualified path to the file that you want to upload (For example: `C:\temp\index.html`).
128
+
### [Portal](#tab/azure-portal)
162
129
163
-
* Replace the `<blob-name>` placeholder value with the name that you want to give the resulting blob (For example: `index.html`).
130
+
These instructions show you how to upload files by using the version of Storage Explorer that appears in the Azure portal. However, you can also use the version of [Storage Explorer](https://azure.microsoft.com/features/storage-explorer/) that runs outside of the Azure portal. You could use [AzCopy](../common/storage-use-azcopy-v10.md), PowerShell, CLI, or any custom application that can upload files to the **$web** container of your account. For a step-by-step tutorial that uploads files by using Visual Studio code, see [Tutorial: Host a static website on Blob Storage](https://docs.microsoft.com/azure/storage/blobs/storage-blob-static-website-host).
164
131
165
-
<a id="powershell-find-url" />
132
+
1. Select **Storage Explorer (preview)**.
133
+
134
+
2. Expand the **BLOB CONTAINERS** node, and then select the **$web** container.
You can view content from a browser by using the public URL of the website.
144
+
>[!NOTE]
145
+
> Storage Explorer automatically sets this property to `text/html` for commonly recognized extensions such as `.html`. However, in some cases, you'll have to set this yourself. If you don't set this property to `text/html`, the browser will prompt users to download the file instead of rendering the contents. To set this property, right-click the file, and then click **Properties**.
170
146
171
-
Find the URL by using the following command:
147
+
### [Azure CLI](#tab/azure-cli)
148
+
149
+
Upload objects to the *$web* container from a source directory.
150
+
151
+
> [!NOTE]
152
+
> If you're using Azure Cloud Shell, make sure to add an `\` escape character when referring to the `$web` container (For example: `\$web`). If you're using a local installation of the Azure CLI, then you won't have to use the escape character.
153
+
154
+
This example assumes that you're running commands from Azure Cloud Shell session.
* Replace the `<storage-account-name>` placeholder value with the name of your storage account.
161
+
162
+
* Replace the `<source-path>` placeholder with a path to the location of the files that you want to upload.
163
+
164
+
> [!NOTE]
165
+
> If you're using a location installation of Azure CLI, then you can use the path to any location on your local computer (For example: `C:\myFolder`.
166
+
>
167
+
> If you're using Azure Cloud Shell, you'll have to reference a file share that is visible to the Cloud Shell. This location could be the file share of the Cloud share itself or an existing file share that you mount from the Cloud Shell. To learn how to do this, see [Persist files in Azure Cloud Shell](https://docs.microsoft.com/azure/cloud-shell/persisting-shell-storage).
168
+
169
+
### [PowerShell](#tab/azure-powershell)
170
+
171
+
Upload objects to the *$web* container from a source directory.
* Replace the `<path-to-file>` placeholder value with the fully qualified path to the file that you want to upload (For example: `C:\temp\index.html`).
183
+
184
+
* Replace the `<blob-name>` placeholder value with the name that you want to give the resulting blob (For example: `index.html`).
185
+
186
+
---
187
+
188
+
## Find the website URL by using the Azure portal
189
+
190
+
You can view the pages of your site from a browser by using the public URL of the website.
191
+
192
+
### [Portal](#tab/azure-portal)
193
+
194
+
<aid="portal-find-url" />
195
+
196
+
In the pane that appears beside the account overview page of your storage account, select **Static Website**. The URL of your site appears in the **Primary endpoint** field.
0 commit comments