config.rst 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. .. _configuration:
  2. =============
  3. Configuration
  4. =============
  5. emqttd消息服务器通过etc/目录下配置文件进行设置,主要配置文件包括:
  6. +-------------------+-----------------------------------+
  7. | 配置文件 | 说明 |
  8. +-------------------+-----------------------------------+
  9. | etc/vm.args | Erlang 虚拟机的参数设置 |
  10. +-------------------+-----------------------------------+
  11. | etc/emqttd.config | emqttd消息服务器参数设置 |
  12. +-------------------+-----------------------------------+
  13. | etc/acl.config | ACL(访问控制规则)设置 |
  14. +-------------------+-----------------------------------+
  15. | etc/clients.config| 基于ClientId认证设置 |
  16. +-------------------+-----------------------------------+
  17. | etc/rewrite.config| Rewrite扩展模块规则配置 |
  18. +-------------------+-----------------------------------+
  19. | etc/ssl/* | SSL证书设置 |
  20. +-------------------+-----------------------------------+
  21. -----------
  22. etc/vm.args
  23. -----------
  24. Configure parameters of Erlang VM:
  25. .. code::
  26. ##-------------------------------------------------------------------------
  27. ## Name of the node
  28. ##-------------------------------------------------------------------------
  29. -name emqttd@127.0.0.1
  30. ## Cookie for distributed erlang
  31. -setcookie emqttdsecretcookie
  32. ##-------------------------------------------------------------------------
  33. ## Flags
  34. ##-------------------------------------------------------------------------
  35. ## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
  36. ## (Disabled by default..use with caution!)
  37. ##-heart
  38. -smp true
  39. ## Enable kernel poll and a few async threads
  40. +K true
  41. ## 12 threads/core.
  42. +A 48
  43. ## max process numbers
  44. +P 8192
  45. ## Sets the maximum number of simultaneously existing ports for this system
  46. +Q 8192
  47. ## max atom number
  48. ## +t
  49. ## Set the distribution buffer busy limit (dist_buf_busy_limit) in kilobytes.
  50. ## Valid range is 1-2097151. Default is 1024.
  51. ## +zdbbl 8192
  52. ## CPU Schedulers
  53. ## +sbt db
  54. ##-------------------------------------------------------------------------
  55. ## Env
  56. ##-------------------------------------------------------------------------
  57. ## Increase number of concurrent ports/sockets, deprecated in R17
  58. -env ERL_MAX_PORTS 8192
  59. -env ERTS_MAX_PORTS 8192
  60. -env ERL_MAX_ETS_TABLES 1024
  61. ## Tweak GC to run more often
  62. -env ERL_FULLSWEEP_AFTER 1000
  63. etc/vm.args中两个最重要的参数:
  64. +-------+----------------------------------------------------------------------------------------------+
  65. | +P | Erlang虚拟机允许的最大进程数,一个MQTT连接会消耗2个Erlang进程,所以参数值 > 最大连接数 * 2 |
  66. +-------+----------------------------------------------------------------------------------------------+
  67. | +Q | Erlang虚拟机允许的最大Port数量,一个MQTT连接消耗1个Port,所以参数值 > 最大连接数 |
  68. +-------+----------------------------------------------------------------------------------------------+
  69. etc/vm.args设置Erlang节点名、节点间通信Cookie::
  70. -name emqttd@127.0.0.1
  71. ## Cookie for distributed erlang
  72. -setcookie emqttdsecretcookie
  73. .. NOTE::
  74. Erlang/OTP平台应用多由分布的Erlang节点(进程)组成,每个Erlang节点(进程)需指配一个节点名,用于节点间通信互访。
  75. 所有互相通信的Erlang节点(进程)间通过一个共用的Cookie进行安全认证。
  76. -----------------
  77. etc/emqttd.config
  78. -----------------
  79. etc/emqttd.config是消息服务器的核心配置文件。Erlang程序由多个应用(application)组成,每个应用(application)有自身的环境参数,
  80. 启动时候通过etc/emqttd.config文件加载。
  81. etc/emqttd.config文件采用的是Erlang数据格式,kernel, sasl, emqttd是Erlang应用(application)名称,'[]'内是应用的环境参数列表。
  82. .. code:: erlang
  83. [{kernel, [
  84. {start_timer, true},
  85. {start_pg2, true}
  86. ]},
  87. {sasl, [
  88. {sasl_error_logger, {file, "log/emqttd_sasl.log"}}
  89. ]},
  90. ...
  91. {emqttd, [
  92. ...
  93. ]}
  94. ].
  95. emqttd.config格式简要说明:
  96. 1. [ ] : 列表,逗号分隔元素
  97. 2. { } : 元组,配置元组一般两个元素{Env, Value}
  98. 3. % : 注释
  99. Log Level and Destination
  100. -------------------------
  101. emqttd消息服务器日志由lager应用(application)提供,日志相关设置在lager应用段落::
  102. {lager, [
  103. ...
  104. ]},
  105. 产品环境下默认只开启error日志,日志输出到logs/emqttd_error.log文件。'handlers'段落启用其他级别日志::
  106. {handlers, [
  107. {lager_console_backend, info},
  108. {lager_file_backend, [
  109. {formatter_config, [time, " ", pid, " [",severity,"] ", message, "\n"]},
  110. {file, "log/emqttd_info.log"},
  111. {level, info},
  112. {size, 104857600},
  113. {date, "$D0"},
  114. {count, 30}
  115. ]},
  116. {lager_file_backend, [
  117. {formatter_config, [time, " ", pid, " [",severity,"] ", message, "\n"]},
  118. {file, "log/emqttd_error.log"},
  119. {level, error},
  120. {size, 104857600},
  121. {date, "$D0"},
  122. {count, 30}
  123. ]}
  124. ]}
  125. .. WARNING:: 过多日志打印严重影响服务器性能,产品环境下建议开启error级别日志。
  126. Broker Parameters
  127. ------------------
  128. emqttd消息服务器参数设置在emqttd应用段落,包括用户认证与访问控制设置,MQTT协议、会话、队列设置,扩展模块设置,TCP服务监听器设置::
  129. {emqttd, [
  130. %% 用户认证与访问控制设置
  131. {access, [
  132. ...
  133. ]},
  134. %% MQTT连接、协议、会话、队列设置
  135. {mqtt, [
  136. ...
  137. ]},
  138. %% 消息服务器设置
  139. {broker, [
  140. ...
  141. ]},
  142. %% 扩展模块设置
  143. {modules, [
  144. ...
  145. ]},
  146. %% 插件目录设置
  147. {plugins, [
  148. ...
  149. ]},
  150. %% TCP监听器设置
  151. {listeners, [
  152. ...
  153. ]},
  154. %% Erlang虚拟机监控设置
  155. {sysmon, [
  156. ]}
  157. ]}
  158. access用户认证设置
  159. ------------------
  160. emqttd消息服务器认证由一系列认证模块(module)或插件(plugin)提供,系统默认支持用户名、ClientID、LDAP、匿名(anonymouse)认证模块::
  161. %% Authetication. Anonymous Default
  162. {auth, [
  163. %% Authentication with username, password
  164. %% Add users: ./bin/emqttd_ctl users add Username Password
  165. %% {username, [{"test", "public"}]},
  166. %% Authentication with clientid
  167. % {clientid, [{password, no}, {file, "etc/clients.config"}]},
  168. %% Authentication with LDAP
  169. % {ldap, [
  170. % {servers, ["localhost"]},
  171. % {port, 389},
  172. % {timeout, 30},
  173. % {user_dn, "uid=$u,ou=People,dc=example,dc=com"},
  174. % {ssl, fasle},
  175. % {sslopts, [
  176. % {"certfile", "ssl.crt"},
  177. % {"keyfile", "ssl.key"}]}
  178. % ]},
  179. %% Allow all
  180. {anonymous, []}
  181. ]},
  182. 系统默认采用匿名认证(anonymous),通过删除注释可开启其他认证方式。同时开启的多个认证模块组成认证链::
  183. ---------------- ---------------- ------------
  184. Client --> | Username认证 | -ignore-> | ClientID认证 | -ignore-> | 匿名认证 |
  185. ---------------- ---------------- ------------
  186. | | |
  187. \|/ \|/ \|/
  188. allow | deny allow | deny allow | deny
  189. .. NOTE:: emqttd消息服务器还提供了MySQL、PostgreSQL、Redis、MongoDB认证插件,
  190. 认证插件加载后认证模块失效。
  191. 用户名密码认证
  192. ..............
  193. .. code:: erlang
  194. {username, [{test1, "passwd1"}, {test2, "passwd2"}]},
  195. 两种方式添加用户:
  196. 1. 直接在[]中明文配置默认用户::
  197. [{test1, "passwd1"}, {test2, "passwd2"}]
  198. 2. 通过'./bin/emqttd_ctl'管理命令行添加用户::
  199. $ ./bin/emqttd_ctl users add <Username> <Password>
  200. ClientID认证
  201. ............
  202. .. code:: erlang
  203. {clientid, [{password, no}, {file, "etc/clients.config"}]},
  204. etc/clients.config文件中添加ClientID::
  205. testclientid0
  206. testclientid1 127.0.0.1
  207. testclientid2 192.168.0.1/24
  208. LDAP认证
  209. ........
  210. .. code:: erlang
  211. {ldap, [
  212. {servers, ["localhost"]},
  213. {port, 389},
  214. {timeout, 30},
  215. {user_dn, "uid=$u,ou=People,dc=example,dc=com"},
  216. {ssl, fasle},
  217. {sslopts, [
  218. {"certfile", "ssl.crt"},
  219. {"keyfile", "ssl.key"}]}
  220. ]},
  221. 匿名认证
  222. ........
  223. 默认开启。允许任意客户端登录::
  224. {anonymous, []}
  225. access用户访问控制(ACL)
  226. -----------------------
  227. emqttd消息服务器支持基于etc/acl.config文件或MySQL、PostgreSQL插件的访问控制规则。
  228. 默认开启基于etc/acl.config文件的访问控制::
  229. %% ACL config
  230. {acl, [
  231. %% Internal ACL module
  232. {internal, [{file, "etc/acl.config"}, {nomatch, allow}]}
  233. ]}
  234. etc/acl.config访问控制规则定义::
  235. 允许|拒绝 用户|IP地址|ClientID 发布|订阅 主题列表
  236. etc/acl.config默认访问规则设置::
  237. {allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}.
  238. {allow, {ipaddr, "127.0.0.1"}, pubsub, ["$SYS/#", "#"]}.
  239. {deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
  240. {allow, all}.
  241. .. NOTE:: 默认规则只允许本机用户订阅'$SYS/#'与'#'
  242. emqttd消息服务器接收到MQTT客户端发布(PUBLISH)或订阅(SUBSCRIBE)请求时,会逐条匹配ACL访问控制规则,
  243. 直到匹配成功返回allow或deny。
  244. MQTT报文(Packet)尺寸与ClientID长度限制
  245. --------------------------------------
  246. 'packet'段落设置最大报文尺寸、最大客户端ID长度::
  247. {packet, [
  248. %% ClientID长度, 默认1024
  249. {max_clientid_len, 1024},
  250. %% 最大报文长度,默认64K
  251. {max_packet_size, 65536}
  252. ]},
  253. MQTT客户端(Client)连接闲置时间
  254. ------------------------------
  255. 'client'段落设置客户端最大允许闲置时间(Socket连接建立,但未发送CONNECT报文)::
  256. {client, [
  257. %% 单位: 秒
  258. {idle_timeout, 10}
  259. ]},
  260. MQTT会话(Session)参数设置
  261. -------------------------
  262. 'session'段落设置MQTT会话参数::
  263. {session, [
  264. %% Max number of QoS 1 and 2 messages that can be “in flight” at one time.
  265. %% 0 means no limit
  266. {max_inflight, 100},
  267. %% Retry interval for redelivering QoS1/2 messages.
  268. {unack_retry_interval, 20},
  269. %% Awaiting PUBREL Timeout
  270. {await_rel_timeout, 20},
  271. %% Max Packets that Awaiting PUBREL, 0 means no limit
  272. {max_awaiting_rel, 0},
  273. %% Statistics Collection Interval(seconds)
  274. {collect_interval, 20},
  275. %% Expired after 2 days
  276. {expired_after, 48}
  277. ]},
  278. 会话参数详细说明:
  279. +----------------------+----------------------------------------------------------+
  280. | max_inflight | 飞行窗口。最大允许同时下发的Qos1/2报文数,0表示没有限制。|
  281. | | 窗口值越大,吞吐越高;窗口值越小,消息顺序越严格 |
  282. +----------------------+----------------------------------------------------------+
  283. | unack_retry_interval | 下发QoS1/2消息未收到PUBACK响应的重试间隔 |
  284. +----------------------+----------------------------------------------------------+
  285. | await_rel_timeout | 收到QoS2消息,等待PUBREL报文超时时间 |
  286. +----------------------+----------------------------------------------------------+
  287. | max_awaiting_rel | 最大等待PUBREL的QoS2报文数 |
  288. +----------------------+----------------------------------------------------------+
  289. | collect_interval | 采集会话统计数据间隔,默认0表示关闭统计 |
  290. +----------------------+----------------------------------------------------------+
  291. | expired_after | 持久会话到期时间,从客户端断开算起,单位:小时 |
  292. +----------------------+----------------------------------------------------------+
  293. MQTT会话消息队列(MQueue)设置
  294. ----------------------------
  295. emqttd消息服务器会话通过队列缓存Qos1/Qos2消息:
  296. 1. 持久会话(Session)的离线消息
  297. 2. 飞行窗口满而延迟下发的消息
  298. 队列参数设置::
  299. {queue, [
  300. %% simple | priority
  301. {type, simple},
  302. %% Topic Priority: 0~255, Default is 0
  303. %% {priority, [{"topic/1", 10}, {"topic/2", 8}]},
  304. %% Max queue length. Enqueued messages when persistent client disconnected,
  305. %% or inflight window is full.
  306. {max_length, infinity},
  307. %% Low-water mark of queued messages
  308. {low_watermark, 0.2},
  309. %% High-water mark of queued messages
  310. {high_watermark, 0.6},
  311. %% Queue Qos0 messages?
  312. {queue_qos0, true}
  313. ]}
  314. 队列参数说明:
  315. +----------------------+---------------------------------------------------+
  316. | type | 队列类型。simple: 简单队列,priority: 优先级队列 |
  317. +----------------------+---------------------------------------------------+
  318. | priority | 主题(Topic)队列优先级设置 |
  319. +----------------------+---------------------------------------------------+
  320. | max_length | 队列长度, infinity表示不限制 |
  321. +----------------------+---------------------------------------------------+
  322. | low_watermark | 解除告警水位线 |
  323. +----------------------+---------------------------------------------------+
  324. | high_watermark | 队列满告警水位线 |
  325. +----------------------+---------------------------------------------------+
  326. | queue_qos0 | 是否缓存QoS0消息 |
  327. +----------------------+---------------------------------------------------+
  328. broker消息服务器参数
  329. --------------------
  330. 'broker'段落设置消息服务器内部模块参数。
  331. sys_interval设置系统发布$SYS消息周期::
  332. {sys_interval, 60},
  333. broker retained消息设置
  334. -----------------------
  335. retained设置MQTT retain消息处理参数::
  336. {retained, [
  337. %% retain消息过期时间,单位: 秒
  338. {expired_after, 0},
  339. %% 最大retain消息数量
  340. {max_message_num, 100000},
  341. %% retain消息payload最大尺寸
  342. {max_playload_size, 65536}
  343. ]},
  344. +-----------------+-------------------------------------+
  345. | expired_after | Retained消息过期时间,0表示永不过期 |
  346. +-----------------+-------------------------------------+
  347. | max_message_num | 最大存储的Retained消息数量 |
  348. +-----------------+-------------------------------------+
  349. | max_packet_size | Retained消息payload最大允许尺寸 |
  350. +-----------------+-------------------------------------+
  351. broker pubsub路由设置
  352. -----------------------
  353. 发布/订阅(Pub/Sub)路由模块参数::
  354. {pubsub, [
  355. %% PubSub Erlang进程池
  356. {pool_size, 8},
  357. %% 订阅存储类型,ram: 内存, disc: 磁盘, false: 不保存
  358. {subscription, ram},
  359. %% 路由老化时间
  360. {route_aging, 5}
  361. ]},
  362. broker bridge桥接参数
  363. -----------------------
  364. 桥接参数设置::
  365. {bridge, [
  366. %% 最大缓存桥接消息数
  367. {max_queue_len, 10000},
  368. %% 桥接节点宕机检测周期,单位: 秒
  369. {ping_down_interval, 1}
  370. ]}
  371. modules扩展模块设置
  372. -----------------------
  373. emqtt消息服务器支持简单的扩展模块,用于定制服务器功能。默认支持presence、subscription、rewrite模块。
  374. 'presence'扩展模块会向$SYS主题(Topic)发布客户端上下线消息::
  375. {presence, [{qos, 0}]},
  376. 'subscription'扩展模块支持客户端上线时,自动订阅或恢复订阅某些主题(Topic)::
  377. %% Subscribe topics automatically when client connected
  378. {subscription, [
  379. %% Subscription from stored table
  380. stored,
  381. %% $u will be replaced with username
  382. {"$Q/username/$u", 1},
  383. %% $c will be replaced with clientid
  384. {"$Q/client/$c", 1}
  385. ]}
  386. 'rewrite'扩展模块支持重写主题(Topic)路径, 重写规则定义在etc/rewrite.config文件::
  387. %% Rewrite rules
  388. %% {rewrite, [{file, "etc/rewrite.config"}]}
  389. 关于扩展模块详细介绍,请参考<用户指南>文档。
  390. plugins插件目录设置
  391. -------------------
  392. .. code:: erlang
  393. {plugins, [
  394. %% Plugin App Library Dir
  395. {plugins_dir, "./plugins"},
  396. %% File to store loaded plugin names.
  397. {loaded_file, "./data/loaded_plugins"}
  398. ]},
  399. listeners监听器设置
  400. -----------------------
  401. emqttd消息服务器开启的MQTT协议、HTTP协议服务端,可通过listener设置TCP服务端口、最大允许连接数等参数。
  402. emqttd消息服务器默认开启的TCP服务端口包括:
  403. +-----------+-----------------------------------+
  404. | 1883 | MQTT协议端口 |
  405. +-----------+-----------------------------------+
  406. | 8883 | MQTT(SSL)端口 |
  407. +-----------+-----------------------------------+
  408. | 8083 | MQTT(WebSocket), HTTP API端口 |
  409. +-----------+-----------------------------------+
  410. .. code:: erlang
  411. {listeners, [
  412. {mqtt, 1883, [
  413. %% Size of acceptor pool
  414. {acceptors, 16},
  415. %% Maximum number of concurrent clients
  416. {max_clients, 8192},
  417. %% Socket Access Control
  418. {access, [{allow, all}]},
  419. %% Connection Options
  420. {connopts, [
  421. %% Rate Limit. Format is 'burst, rate', Unit is KB/Sec
  422. %% {rate_limit, "100,10"} %% 100K burst, 10K rate
  423. ]},
  424. %% Socket Options
  425. {sockopts, [
  426. %Set buffer if hight thoughtput
  427. %{recbuf, 4096},
  428. %{sndbuf, 4096},
  429. %{buffer, 4096},
  430. %{nodelay, true},
  431. {backlog, 1024}
  432. ]}
  433. ]},
  434. {mqtts, 8883, [
  435. %% Size of acceptor pool
  436. {acceptors, 4},
  437. %% Maximum number of concurrent clients
  438. {max_clients, 512},
  439. %% Socket Access Control
  440. {access, [{allow, all}]},
  441. %% SSL certificate and key files
  442. {ssl, [{certfile, "etc/ssl/ssl.crt"},
  443. {keyfile, "etc/ssl/ssl.key"}]},
  444. %% Socket Options
  445. {sockopts, [
  446. {backlog, 1024}
  447. %{buffer, 4096},
  448. ]}
  449. ]},
  450. %% WebSocket over HTTPS Listener
  451. %% {https, 8083, [
  452. %% %% Size of acceptor pool
  453. %% {acceptors, 4},
  454. %% %% Maximum number of concurrent clients
  455. %% {max_clients, 512},
  456. %% %% Socket Access Control
  457. %% {access, [{allow, all}]},
  458. %% %% SSL certificate and key files
  459. %% {ssl, [{certfile, "etc/ssl/ssl.crt"},
  460. %% {keyfile, "etc/ssl/ssl.key"}]},
  461. %% %% Socket Options
  462. %% {sockopts, [
  463. %% %{buffer, 4096},
  464. %% {backlog, 1024}
  465. %% ]}
  466. %%]},
  467. %% HTTP and WebSocket Listener
  468. {http, 8083, [
  469. %% Size of acceptor pool
  470. {acceptors, 4},
  471. %% Maximum number of concurrent clients
  472. {max_clients, 64},
  473. %% Socket Access Control
  474. {access, [{allow, all}]},
  475. %% Socket Options
  476. {sockopts, [
  477. {backlog, 1024}
  478. %{buffer, 4096},
  479. ]}
  480. ]}
  481. ]},
  482. listener参数说明:
  483. +-------------+-----------------------------------------------------------+
  484. | acceptors | TCP Acceptor池 |
  485. +-------------+-----------------------------------------------------------+
  486. | max_clients | 最大允许TCP连接数 |
  487. +-------------+-----------------------------------------------------------+
  488. | access | 允许访问的IP地址段设置,例如: [{allow, "192.168.1.0/24"}] |
  489. +-------------+-----------------------------------------------------------+
  490. | connopts | 连接限速配置,例如限速10KB/秒: {rate_limit, "100,10"} |
  491. +-------------+-----------------------------------------------------------+
  492. | sockopts | Socket参数设置 |
  493. +-------------+-----------------------------------------------------------+
  494. .. _config_acl:
  495. --------------
  496. etc/acl.config
  497. --------------
  498. emqttd消息服务器默认访问控制规则配置在etc/acl.config文件。
  499. 访问控制规则采用Erlang元组格式,访问控制模块逐条匹配规则::
  500. --------- --------- ---------
  501. Client -> | Rule1 | --nomatch--> | Rule2 | --nomatch--> | Rule3 | --> Default
  502. --------- --------- ---------
  503. | | |
  504. match match match
  505. \|/ \|/ \|/
  506. allow | deny allow | deny allow | deny
  507. etc/acl.config文件默认规则设置::
  508. %% 允许'dashboard'用户订阅 '$SYS/#'
  509. {allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}.
  510. %% 允许本机用户发布订阅全部主题
  511. {allow, {ipaddr, "127.0.0.1"}, pubsub, ["$SYS/#", "#"]}.
  512. %% 拒绝用户订阅'$SYS#'与'#'主题
  513. {deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
  514. %% 上述规则无匹配,允许
  515. {allow, all}.
  516. .. _config_rewrite:
  517. ------------------
  518. etc/rewrite.config
  519. ------------------
  520. Rewrite扩展模块的规则配置文件,示例配置::
  521. {topic, "x/#", [
  522. {rewrite, "^x/y/(.+)$", "z/y/$1"},
  523. {rewrite, "^x/(.+)$", "y/$1"}
  524. ]}.
  525. {topic, "y/+/z/#", [
  526. {rewrite, "^y/(.+)/z/(.+)$", "y/z/$2"}
  527. ]}.