生活中的Design.

NuxtJS非根目录下部署

字数统计: 260阅读时长: 1 min
2021/08/05 Share

NuxtJS非根目录下部署

nuxt start命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Usage: nuxt start <dir> [options]

Start the application in production mode (the application should be compiled
with nuxt build first)

Options:

--spa, -s Launch in SPA mode
--universal, -u Launch in Universal mode (default)
--config-file, -c Path to Nuxt config file (default: nuxt.config)
--modern, -m Build/Start app for modern browsers, e.g. server, client
and false
--target, -t Build/start app for a different target, e.g. server,
serverless and static
--force-exit Whether Nuxt should force exit after the command has
finished
--version, -v Display the Nuxt version
--help, -h Display this message
--no-processenv Disable reading from process.env and updating it with
dotenv
--dotenv Specify path to dotenv file (default: .env). Use false
to disable
--port, -p Port number on which to start the application
--hostname, -H Hostname on which to start the application
--unix-socket, -n Path to a UNIX socket

nuxt start 可以跟一个dir参数,(会覆盖nuxt.config.jsrootDir参数),用于指定工作的根目录,例如我我将NUXTJS部署所需的文件放到NGINX文件服务目录下的test路径(例如全路径是/usr/share/nginx/html/test/),在test目录下运行nuxt start ./或者nuxt start /usr/share/nginx/html/test/,node服务所指向的工作目录会在当前目录(test)。

CATALOG
  1. 1. NuxtJS非根目录下部署
    1. 1.1. nuxt start命令