Skip to content

Commit 1b2925a

Browse files
icyJosephhuozhi
authored andcommitted
docs: recommend reverse-proxy when self-hosting (#85650)
1 parent 3c8870e commit 1b2925a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/01-app/02-guides/self-hosting.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ When [deploying](/docs/app/getting-started/deploying) your Next.js app, you may
1010

1111
> **🎥 Watch:** Learn more about self-hosting Next.js → [YouTube (45 minutes)](https://www.youtube.com/watch?v=sIVL4JMqRfc).
1212
13+
## Reverse Proxy
14+
15+
When self-hosting, it's recommended to use a reverse proxy (like nginx) in front of your Next.js server rather than exposing it directly to the internet. A reverse proxy can handle malformed requests, slow connection attacks, payload size limits, rate limiting, and other security concerns, offloading these tasks from the Next.js server. This allows the server to dedicate its resources to rendering rather than request validation.
16+
1317
## Image Optimization
1418

1519
[Image Optimization](/docs/app/api-reference/components/image) through `next/image` works self-hosted with zero configuration when deploying using `next start`. If you would prefer to have a separate service to optimize images, you can [configure an image loader](/docs/app/api-reference/components/image#loader).
@@ -186,9 +190,9 @@ When the application is reloaded, there may be a loss of application state if it
186190

187191
## Streaming and Suspense
188192

189-
The Next.js App Router supports [streaming responses](/docs/app/api-reference/file-conventions/loading) when self-hosting. If you are using Nginx or a similar proxy, you will need to configure it to disable buffering to enable streaming.
193+
The Next.js App Router supports [streaming responses](/docs/app/api-reference/file-conventions/loading) when self-hosting. If you are using nginx or a similar proxy, you will need to configure it to disable buffering to enable streaming.
190194

191-
For example, you can disable buffering in Nginx by setting `X-Accel-Buffering` to `no`:
195+
For example, you can disable buffering in nginx by setting `X-Accel-Buffering` to `no`:
192196

193197
```js filename="next.config.js"
194198
module.exports = {

0 commit comments

Comments
 (0)