TiddlyWiki5/languages/zh-Hans/Help/server.tid

44 lines
2.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

title: $:/language/Help/server
description: 提供一个 HTTP 服务器界面到 TiddlyWiki (已弃用,支持新的 listen 命令)
在服务器中内置 TiddlyWiki5 是非常简单。虽与 TiddlyWeb 兼容,但不支持许多健全互联网面向的使用方式所需的功能。
提供呈现一个指定条目,也可将个别条目编码成 JSON且支持基础的 HTTP 操作 `GET`、`PUT` 及 `DELETE`.
```
--server <port> <root-tiddler> <root-render-type> <root-serve-type> <username> <password> <host> <path-prefix> <debug-level>
```
参数说明:
* ''port'' - 要侦听的埠号;非数值会被解译为一个系统环境变数,从其中提取埠号 (默认为 "8080")
* ''root-tiddler'' - 服务的基础条目 (默认为 "$:/core/save/all")
* ''root-render-type'' - 呈现的基础条目的内容类型 (默认为 "text/plain")
* ''root-serve-type'' - 服务的基础条目的内容类型 (默认为 "text/html")
* ''username'' - 默认的编辑者署名
* ''password'' - 可选的基础验证密码
* ''host'' - 可选的主机名称, (默认为 "127.0.0.1" 或名为 "localhost")
* ''path-prefix'' - 可选的路径前缀
* ''debug-level'' - 可选的调试级别;设置为 "debug" 来查看请求的详细信息;(默认为 "none")
若指定密码参数,浏览器将提示使用者输入用户名与密码。注意,密码系以明码方式传递,应只在受信任的网络或 HTTPS 上使用。
例如:
```
--server 8080 $:/core/save/all text/plain text/html MyUserName passw0rd
```
若您需要设置主机名称或路径前缀,而不要求输入密码,则可以指定空字符串的使用者名和密码。
```
--server 8080 $:/core/save/all text/plain text/html "" "" 192.168.0.245
```
使用这样的位址,会将您的系统暴露给本地网络。有关向整个本地网络开启实例的信息,以及可能的安全问题,请参阅 TiddlyWiki.com 的 WebServer 条目。
同时执行多个 TiddlyWiki 服务,须分别指定不同的埠号。使用环境变数,有助于将埠号传递给 Node.js 进程。本示例引用一个名为 "MY_PORT_NUMBER" 的环境变数:
```
--server MY_PORT_NUMBER $:/core/save/all text/plain text/html MyUserName passw0rd
```