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

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

在构建好的 Nuxt 3 应用中，不存在运行时 Nuxt 依赖。这意味着你的网站将具有极高的性能和极简的体积。但这也意味着你不能再挂载运行时的 Nuxt 服务器钩子。

::read-more{to="https://nuxt.zhcndoc.com/docs/3.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/3.x/directory-structure/server"}
::

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


## Sitemap

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