Skip to content

Commit c899478

Browse files
authored
Merge pull request #214165 from chcomley/users/chcomley/deply-nextjs-1995787
Refresh deploy-nextjs.md
2 parents 93b1df6 + ffce4ed commit c899478

File tree

1 file changed

+35
-29
lines changed

1 file changed

+35
-29
lines changed
Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,73 @@
11
---
2-
title: "Tutorial: Deploy static-rendered Next.js websites on Azure Static Web Apps"
2+
title: "Deploy static-rendered Next.js websites on Azure Static Web Apps"
33
description: "Generate and deploy Next.js dynamic sites with Azure Static Web Apps."
44
services: static-web-apps
55
author: craigshoemaker
66
ms.service: static-web-apps
77
ms.topic: tutorial
8-
ms.date: 03/26/2022
8+
ms.date: 10/11/2022
99
ms.author: cshoe
10-
ms.custom: devx-track-js
10+
ms.custom: devx-track-js, engagement-fy23
1111
---
1212

13-
1413
# Deploy static-rendered Next.js websites on Azure Static Web Apps
1514

16-
In this tutorial, you learn to deploy a [Next.js](https://nextjs.org) generated static website to [Azure Static Web Apps](overview.md). For more information about Next.js specifics, see the [starter template's readme](https://github.com/staticwebdev/nextjs-starter#readme).
15+
In this tutorial, learn to deploy a [Next.js](https://nextjs.org) generated static website to [Azure Static Web Apps](overview.md). For more information about Next.js specifics, see the [starter template readme](https://github.com/staticwebdev/nextjs-starter#readme).
1716

1817
## Prerequisites
1918

2019
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/).
2120
- A GitHub account. [Create an account for free](https://github.com/join).
2221
- [Node.js](https://nodejs.org) installed.
2322

24-
## Set up a Next.js app
23+
## 1. Set up a Next.js app
2524

26-
Rather than using the Next.js CLI to create your app, you can use a starter repository. The starter repository contains an existing Next.js application that supports dynamic routes.
25+
Rather than using the Next.js CLI to create your app, you can use a starter repository. The starter repository contains an existing Next.js app that supports dynamic routes.
2726

2827
To begin, create a new repository under your GitHub account from a template repository.
2928

30-
1. Navigate to [https://github.com/staticwebdev/nextjs-starter/generate](https://github.com/login?return_to=/staticwebdev/nextjs-starter/generate)
31-
1. Name the repository **nextjs-starter**
32-
1. Next, clone the new repo to your machine. Make sure to replace `<YOUR_GITHUB_ACCOUNT_NAME>` with your account name.
29+
1. Go to [https://github.com/staticwebdev/nextjs-starter/generate](https://github.com/login?return_to=/staticwebdev/nextjs-starter/generate).
30+
2. Name the repository **nextjs-starter**.
31+
3. Clone the new repo to your machine. Make sure to replace `<YOUR_GITHUB_ACCOUNT_NAME>` with your account name.
3332

3433
```bash
3534
git clone http://github.com/<YOUR_GITHUB_ACCOUNT_NAME>/nextjs-starter
3635
```
3736

38-
1. Navigate to the newly cloned Next.js app:
37+
4. Go to the newly cloned Next.js app.
3938

4039
```bash
4140
cd nextjs-starter
4241
```
4342

44-
1. Install dependencies:
43+
5. Install dependencies.
4544

4645
```bash
4746
npm install
4847
```
4948

50-
1. Start Next.js app in development:
49+
6. Start Next.js app in development.
5150

5251
```bash
5352
npm run dev
5453
```
5554

56-
Navigate to `http://localhost:3000` to open the app, where you should see the following website open in your preferred browser:
55+
7. Go to `http://localhost:3000` to open the app, where you should see the following website open in your preferred browser.
5756

5857
:::image type="content" source="media/deploy-nextjs/start-nextjs-app.png" alt-text="Start Next.js app":::
5958

6059
When you select a framework or library, you see a details page about the selected item:
6160

6261
:::image type="content" source="media/deploy-nextjs/start-nextjs-details.png" alt-text="Details page":::
6362

64-
## Deploy your static website
63+
## 2. Create a static app
6564

6665
The following steps show how to link your app to Azure Static Web Apps. Once in Azure, you can deploy the application to a production environment.
6766

68-
### Create a static app
69-
70-
1. Navigate to the [Azure portal](https://portal.azure.com).
67+
1. Go to the [Azure portal](https://portal.azure.com).
7168
1. Select **Create a Resource**.
7269
1. Search for **Static Web Apps**.
73-
1. Select **Static Web Apps**.
70+
1. Select **Static Web App**.
7471
1. Select **Create**.
7572
1. On the _Basics_ tab, enter the following values.
7673

@@ -83,7 +80,7 @@ The following steps show how to link your app to Azure Static Web Apps. Once in
8380
| _Region for Azure Functions API and staging environments_ | Select a region closest to you. |
8481
| _Source_ | **GitHub** |
8582

86-
1. Select **Sign in with GitHub** and authenticate with GitHub.
83+
1. Select **Sign in with GitHub** and authenticate with GitHub, if prompted.
8784

8885
1. Enter the following GitHub values.
8986

@@ -101,41 +98,50 @@ The following steps show how to link your app to Azure Static Web Apps. Once in
10198
| _Api location_ | Leave this box empty. |
10299
| _Output location_ | Enter **out** in the box. |
103100

104-
### Review and create
101+
## 3. Review and create
105102

106103
1. Select the **Review + Create** button to verify the details are all correct.
107104

108105
1. Select **Create** to start the creation of the App Service Static Web App and provision a GitHub Actions for deployment.
109106

110107
1. Once the deployment completes select, **Go to resource**.
111108

112-
1. On the _Overview_ window, select the *URL* link to open your deployed application.
109+
2. On the _Overview_ window, select the *URL* link to open your deployed app.
113110

114111
If the website doesn't load immediately, then the build is still running. Once the workflow is complete, you can refresh the browser to view your web app.
115112
116-
To check the status of the Actions workflow, navigate to the Actions dashboard for your repository:
113+
To check the status of the Actions workflow, go to the *Actions* dashboard for your repository:
117114
118115
```url
119116
https://github.com/<YOUR_GITHUB_USERNAME>/nextjs-starter/actions
120117
```
121118
122119
Now any changes made to the `main` branch start a new build and deployment of your website.
123120
124-
### Sync changes
121+
## 4. Sync changes
125122
126123
When you created the app, Azure Static Web Apps created a GitHub Actions file in your repository. Synchronize with the server by pulling down the latest to your local repository.
127124
128125
Return to the terminal and run the following command `git pull origin main`.
129126
130127
## Clean up resources
131128
132-
If you're not going to continue to use this application, you can delete the Azure Static Web Apps instance through the following steps:
129+
If you're not going to continue to use this app, you can delete the Azure Static Web Apps instance through the following steps.
133130

134131
1. Open the [Azure portal](https://portal.azure.com).
135-
1. Search for **my-nextjs-group** from the top search bar.
136-
1. Select on the group name.
137-
1. Select on the **Delete** button.
138-
1. Select **Yes** to confirm the delete action.
132+
2. Search for **my-nextjs-group** from the top search bar.
133+
3. Select on the group name.
134+
4. Select on the **Delete** button.
135+
5. Select **Yes** to confirm the delete action.
136+
137+
## Next steps
139138

140139
> [!div class="nextstepaction"]
141140
> [Set up a custom domain](custom-domain.md)
141+
142+
## Related articles
143+
144+
- [Set up authentication and authorization](authentication-authorization.md)
145+
- [Configure app settings](application-settings.md)
146+
- [Enable monitoring](monitor.md)
147+
- [Azure CLI](https://github.com/Azure/static-web-apps-cli)

0 commit comments

Comments
 (0)