Skip to content

Commit 66672e3

Browse files
committed
Add Azure Blob Storage hosting guide and update local hosting docs
- Add new documentation for hosting static content in Azure Blob Storage - Update existing static content guide to focus on local hosting - Add cross-references between local and blob storage hosting methods
1 parent ab184bd commit 66672e3

File tree

2 files changed

+124
-3
lines changed

2 files changed

+124
-3
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: Hosting static content in Azure Blob Storage
3+
weight: 210
4+
toc: true
5+
nd-docs: DOCS-1344
6+
url: /nginxaas/azure/quickstart/hosting-static-content-blob-storage/
7+
type:
8+
- how-to
9+
---
10+
11+
F5 NGINXaaS for Azure (NGINXaaS) can serve static content stored in Azure Blob Storage, allowing you to host large static websites without the configuration payload size limitations of local hosting. This approach also keeps your storage account private by restricting access to your NGINXaaS deployment.
12+
13+
## Prerequisites
14+
15+
- An Azure Storage Account
16+
- An NGINXaaS for Azure deployment
17+
- Static content files to serve
18+
19+
## Configure Azure Blob Storage
20+
21+
### Step 1: Upload static files to the $web container
22+
23+
Place your static files in the `$web` container in your storage account. This is the standard container used for static website hosting in Azure.
24+
25+
### Step 2: Configure network access
26+
27+
1. In your storage account, navigate to **Networking** under **Security + networking**.
28+
2. Under **Public network access**, select **Enable public access from selected virtual networks and IP addresses**.
29+
3. In the **Virtual networks** section, click **Add existing virtual network**.
30+
4. Select the virtual network and subnet where your NGINXaaS deployment is located.
31+
5. Click **Add** to allow your NGINXaaS deployment to connect to the storage account.
32+
33+
{{< call-out "note" >}}This configuration ensures that your storage account is not accessible from the public Internet, only from your NGINXaaS deployment's subnet.{{< /call-out >}}
34+
35+
### Step 3: Enable static website hosting
36+
37+
1. In your storage account, navigate to **Static website** under **Data management**.
38+
2. Enable **Static website**.
39+
3. Set your **Index document name** (e.g., `index.html`).
40+
4. Optionally, set an **Error document path** for 404 errors.
41+
5. Click **Save**.
42+
43+
Note the **Primary endpoint** URL that appears after enabling static website hosting. You'll need this for your NGINX configuration.
44+
45+
## Configure NGINXaaS
46+
47+
Create an NGINX configuration that proxies requests to your Azure Blob Storage static website endpoint:
48+
49+
```nginx
50+
user nginx;
51+
worker_processes auto;
52+
worker_rlimit_nofile 8192;
53+
pid /run/nginx/nginx.pid;
54+
55+
error_log /var/log/nginx/error.log error;
56+
57+
http {
58+
upstream storage_origin {
59+
server your-storage-account.z20.web.core.windows.net:443;
60+
keepalive 32;
61+
}
62+
63+
server {
64+
listen 443 ssl;
65+
ssl_certificate /etc/nginx/example.cert;
66+
ssl_certificate_key /etc/nginx/example.key;
67+
68+
location /static/ {
69+
proxy_pass https://storage_origin/content/;
70+
proxy_set_header Host your-storage-account.z20.web.core.windows.net;
71+
proxy_http_version 1.1;
72+
proxy_set_header Connection "";
73+
}
74+
}
75+
}
76+
```
77+
78+
{{< call-out "important" >}}Replace `your-storage-account` with your actual storage account name in both the upstream server definition and the `proxy_set_header Host` directive. The region code (e.g., `z20`) may vary depending on your storage account's region.{{< /call-out >}}
79+
80+
### Configuration breakdown
81+
82+
- **upstream storage_origin**: Defines the Azure Blob Storage static website endpoint as the backend server
83+
- **keepalive 32**: Maintains persistent connections to the storage endpoint for better performance
84+
- **location /static/**: Maps the `/static/` path on your NGINXaaS deployment to the `/content/` path in your static website
85+
- **proxy_pass**: Forwards requests to the Azure Blob Storage endpoint with the `/content/` path
86+
- **proxy_set_header Host**: Sets the correct Host header for the storage account
87+
- **proxy_http_version 1.1**: Uses HTTP/1.1 for better connection reuse
88+
- **proxy_set_header Connection ""**: Clears the connection header for proper keepalive behavior
89+
90+
## Upload the configuration
91+
92+
Upload your NGINX configuration to your NGINXaaS deployment following the instructions in the [NGINX configuration]({{< ref "/nginxaas-azure/getting-started/nginx-configuration/nginx-configuration-portal.md" >}}) documentation.
93+
94+
## Test the configuration
95+
96+
1. Browse to `https://<NGINXaaS IP>/static/<your-file-name>` to access your static content.
97+
2. For example, if you have an `index.html` file in your `$web` container, access it via `https://<NGINXaaS IP>/static/index.html`.
98+
3. Your content should be served from Azure Blob Storage through your NGINXaaS deployment.
99+
100+
## Verify traffic routing
101+
102+
You can verify that requests are properly routed through your NGINXaaS deployment by checking the Azure Storage logs:
103+
104+
1. Enable logging for your storage account if not already enabled.
105+
2. In the storage logs, you should see requests coming from the private IP address of your NGINXaaS deployment, not from public Internet addresses.
106+
107+
## Benefits of this approach
108+
109+
- **No payload size limits**: Unlike local hosting, you're not limited by the 3 MB configuration payload size
110+
- **Scalable storage**: Azure Blob Storage can handle large amounts of static content
111+
- **Private access**: Your storage account remains private and is only accessible through your NGINXaaS deployment
112+
- **Cost-effective**: Azure Blob Storage offers cost-effective storage for static content
113+
- **Global availability**: Leverage Azure's global infrastructure for content delivery
114+
115+
## Limitations
116+
117+
- Requires network connectivity between your NGINXaaS deployment and the storage account
118+
- Additional latency compared to locally hosted content due to the proxy pass to Azure Blob Storage
119+
- Storage account must be in a region that allows network connectivity to your NGINXaaS deployment

content/nginxaas-azure/quickstart/hosting-static-content.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Hosting static content
2+
title: Hosting static content locally
33
weight: 200
44
toc: true
55
nd-docs: DOCS-1344
@@ -8,7 +8,7 @@ type:
88
- how-to
99
---
1010

11-
F5 NGINXaaS for Azure (NGINXaaS) supports hosting static content which allows users to serve static websites from their deployment.
11+
F5 NGINXaaS for Azure (NGINXaaS) supports hosting static content locally on the deployment, which allows users to serve static websites directly from their deployment.
1212

1313
## Uploading static files as a tarball
1414

@@ -30,7 +30,7 @@ http {
3030

3131
2. Store your static files alongside the NGINX configuration.
3232

33-
The following shows the structure of a directory containing an NGINX configuration and an `index.html` file that we will be served from the deployment.
33+
The following shows the structure of a directory containing an NGINX configuration and an `index.html` file that will be served from the deployment.
3434

3535
```shell
3636
test-static-files $ tree .
@@ -65,3 +65,5 @@ You can also upload static files directly to the deployment. See [Adding NGINX C
6565
## Limitations
6666

6767
NGINX Configuration payload larger than 3 MB is not supported.
68+
69+
For hosting larger static content or to avoid the payload size limitation, consider [hosting static content in Azure Blob Storage]({{< ref "/nginxaas-azure/quickstart/hosting-static-content-blob-storage.md" >}}).

0 commit comments

Comments
 (0)