---
title: "服务器"
description: "了解如何将 Nuxt 2 的服务器迁移到 Nuxt 3。"
canonical_url: "https://nuxt.zhcndoc.com/docs/4.x/migration/server"
---
# 服务器

> 了解如何将 Nuxt 2 的服务器迁移到 Nuxt 3。

在已构建的 Nuxt 3 应用中，不存在运行时的 Nuxt 依赖。这意味着你的网站将具有很高的性能并且体积极小。但这也意味着你不能再挂载到运行时 Nuxt 服务端钩子。

::read-more{to="https://nuxt.zhcndoc.com/docs/4.x/guide/concepts/server-engine"}
::

## 步骤

1. 在你的 `nuxt.config` 中移除 `render` 键。
2. 位于 `~/server/api` 和 `~/server/middleware` 的任何文件将会被自动注册；你可以从你的 `serverMiddleware` 数组中移除它们。
3. 将 `serverMiddleware` 数组中其他项更新为直接指向文件或 npm 包，而不是使用内联函数。

::read-more{to="https://nuxt.zhcndoc.com/docs/4.x/directory-structure/server"}
::

::read-more{to="https://nuxt.zhcndoc.com/docs/4.x/guide/going-further/hooks#server-hooks-runtime"}
::


## Sitemap

See the full [sitemap](https://nuxt.zhcndoc.com/sitemap.md) for all pages.
