This guided project consists of the following exercises:
- Create storage account and enable hosting
- Upload and verify site content
- Update the site content
In this exercise, you create an HTML page and a custom error page, upload both to the $web container, and visit your live site to confirm everything works. This is where your static website goes from an empty endpoint to a real page that anyone can visit.
This exercise includes the following tasks:
- Create the HTML file locally
- Upload the file to the $web container
- Create and upload a custom error page
- Verify the live site and error page
Outcome: A live public website displaying your Version 1 content.
Task 1: Create the HTML file locally
Create a simple HTML file on your computer that will serve as the initial version of your website. This file represents the content your team wants to publish.
-
On your local computer, open a text editor (such as Notepad).
-
Paste the following content:
<!DOCTYPE html> <html> <head><title>Product Landing Page</title></head> <body> <h1>Version 1 - Landing Page</h1> <p>Welcome to our product page. This is the initial published version.</p> </body> </html> -
Save the file as index.html.
Task 2: Upload the file to the $web container
Upload your HTML file to the special $web container that Azure created when you enabled static website hosting. Files in this container are automatically served to visitors who browse to your site endpoint.
- In the Azure portal, return to your storage account.
- In the left menu, under Data storage, select Containers.
- Select the $web container.
- Select Upload.
- Select Browse for files, select the index.html file you created, and upload it.
- Confirm that index.html appears in the container file list.
Task 3: Create and upload a custom error page
Create a custom 404 error page that visitors see when they browse to a page that doesn't exist. Without this file, visitors get a generic XML error, which looks unprofessional.
-
On your local computer, open a text editor.
-
Paste the following content:
<!DOCTYPE html> <html> <head><title>Page Not Found</title></head> <body> <h1>404 - Page Not Found</h1> <p>The page you requested does not exist. Return to the <a href="/">home page</a>.</p> </body> </html> -
Save the file as 404.html.
-
In the Azure portal, return to the $web container.
-
Select Upload, select Browse for files, select the 404.html file, and upload it.
-
Confirm that both index.html and 404.html appear in the container.
[!NOTE] Validation step: The $web container should list both index.html and 404.html.
Task 4: Verify the live site and error page
Open the public endpoint in a browser to confirm your website is live, and then test the custom error page. This validates that static website hosting is correctly configured for both normal pages and missing pages.
- In the Azure portal, navigate back to your storage account (use the portal search bar to search for Storage accounts and select your account if needed).
- In the left menu, under Data management, select Static website.
- Select the Primary endpoint link to open the site in a new browser tab.
- Confirm the page displays Version 1 - Landing Page and the welcome message.
- In the browser address bar, add /fakepage to the end of the URL and press Enter.
- Confirm the custom 404 page appears with the Page Not Found heading and a link back to the home page.
- Select the home page link and confirm it returns to the Version 1 landing page.
[!NOTE] Validation step: The landing page displays Version 1 - Landing Page, and browsing to a nonexistent path shows your custom 404 - Page Not Found page.