【发布时间】:2016-06-13 06:46:45
【问题描述】:
您好,我已经安装了带有扩展可视化编辑器、nodejs 和 parsoid 的 mediawiki 1.26.2,问题是当我启动 parsoid 时,似乎每个进程都正常工作,但 parsoid 和 visualeditor 的配置,我可以'在我的 wiki 中看不到任何编辑器。
我在下面描述了我的所有配置,我如何启动 parsoid,涉及的 parsoid 过程以及媒体 wiki 配置文件的 localsettings 中的配置行。
/etc/init.d/parsoid2 开始-结束脚本:
#!/bin/bash
#
# chkconfig: 35 90 12
# description: Foo server
#
# Get function from functions library
#. /etc/init.d/functions
# Start the service PARSOID
SCRIPT_PATH="/usr/lib/parsoid/src/bin/server.js"
DAEMON="/usr/bin/node $SCRIPT_PATH"
DAEMON_ARGS=""
start() {
#initlog -c "echo -n Starting PARSOID server: "
ulimit -n 64000
/usr/bin/node /usr/lib/parsoid/src/bin/server.js >> /var/log/parsoid/parsoid.log 2>&1 &
### Create the lock file ###
#touch /var/lock/subsys/parsoid
success $"PARSOID server startup"
echo
}
# Restart the service PARSOID
stop() {
#initlog -c "echo -n Stopping PARSOID server: "
pkill -f server.js
### Now, delete the lock file ###
rm -f /var/lock/subsys/parsoid
echo
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status parsoid_nodejs.sh
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
运行 /etc/init.d/parsoid2 start 后涉及的 parsoid 进程
root@vscj016mlinuxserver:~# ps -ef | grep parsoid
root 2244 1 0 08:21 pts/0 00:00:00 /usr/bin/node /usr/lib/parsoid/src/bin/server.js
root 2251 2244 0 08:21 pts/0 00:00:00 /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js
root 2252 2244 0 08:21 pts/0 00:00:00 /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js
root 2258 2244 0 08:21 pts/0 00:00:00 /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js
root 2264 2244 0 08:21 pts/0 00:00:00 /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js
root 2437 2023 0 08:36 pts/0 00:00:00 grep --color=auto parsoid
root@vscj016mlinuxserver:~#
Localsetting.js parsoid 配置文件:
exports.setup = function(parsoidConfig) {
// Set your own user-agent string
// Otherwise, defaults to "Parsoid/<current-version-defined-in- package.json>"
//parsoidConfig.userAgent = "My-User-Agent-String";
// Configure Parsoid to point to your MediaWiki instance.
parsoidConfig.setMwApi({
// The "prefix" is the name given to this wiki configuration in the
// (deprecated) Parsoid v1 API.
prefix: 'localhost', // optional
// The "domain" is used for communication with Visual Editor
// and RESTBase. It defaults to the hostname portion of
// the `uri` property below, but you can manually set it
// to an arbitrary string.
domain: 'localhost', // optional
// This is the only required parameter:
// the URL of you MediaWiki API endpoint.
uri: 'http://localhost/mediawiki/api.php',
// To specify a proxy (or proxy headers) specific to this prefix
// (which overrides defaultAPIProxyURI). Alternatively, set `proxy`
// to `null` to override and force no proxying when a default proxy
// has been set.
/*
proxy: {
uri: 'http://my.proxy:1234/',
headers: { 'X-Forwarded-Proto': 'https' } // headers are optional
}
*/
});
VisualEditor 的配置位于 /var/www/HTML/mediawiki/Localsettings.php:
require_once "$IP/extensions/VisualEditor/VisualEditor.php";
wfLoadExtension ( 'VisualEditor' );
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgDefaultUserOptions['minordefault'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVisualEditorParsoidURL = 'http://localhost:8000';
$wgVirtualRestConfig['modules']['parsoid'] = array('url' => 'http://localhost:8000', 'domain' => 'localhost', 'prefix' => 'localhost');
$wgSessionsInObjectCache = true;
$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;
【问题讨论】:
-
发布一些日志,不仅仅是配置。这个地址可以使用 Api 吗?
http://localhost/mediawiki/api.php还有check parsoid actually work 和yourDomain:8000/_wikitext/ -
感谢您的回答 teo van kot,我只想解释一下,我在 localhost/mediawiki/api.php 收到了回答,另一方面,我在 localhost:8000/_wikitext 收到了回答,网络回答网站显示“前缀无效: enwiki" 我不知道这是否是 parsoid 的正确或错误答案。
-
这是 /var/log/parsoid/parsoid.log 的输出:[info][master][2506] 初始化 4 个 worker [info][worker][2513] loading ... [ info][worker][2514] loading ... [info][worker][2520] loading ... [info][worker][2526] loading ... [info][worker][2514] 准备就绪: 8000 [info][worker][2520] 准备就绪:8000 [info][worker][2513] 准备就绪:8000 [info][worker][2526] 准备就绪:8000 [致命/请求][worker][2513 ] 前缀无效:enwiki root@vscj016mlinuxserver:~#
-
首先,它应该是
http://localhost:8000/_wikitext/<your_prefix>/,所以在你的情况下是http://localhost:8000/_wikitext/localhost/。其次,删除require_once "$IP/extensions/VisualEditor/VisualEditor.php";已经由wfLoadExtension ( 'VisualEditor' );完成的行。第三,检查 Special:Version,如果 Visual Editors 出现在那里。另外,请阅读下面我的其他答案。