V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
RiESA
V2EX  ›  问与答

MediaWiki 安装 VisualEditor,编辑器和 parsoid 无法连接求助

  •  
  •   RiESA · 2018-05-08 19:36:55 +08:00 · 4650 次点击
    这是一个创建于 2186 天前的主题,其中的信息可能已经有所发展或是发生改变。

    CentOS7 8000 端口已经打开

    SELINUX 也是关闭状态

    MediaWiki 版本 1.29.2

    访问 http://wiki.riesa.me:8000/

    可以显示 parsoid 正在运行,但是使用编辑器会出现 404 及 curl error 7 这两个错误

    下面附上相关配置文件的片段,不知道有没有熟悉 MW 的大佬看看是什么情况,昨晚通宵折腾到现在了

    LocalSettings.php:

    require_once "$IP/extensions/VisualEditor/VisualEditor.php";

    $wgDefaultUserOptions['visualeditor-enable'] = 1;

    $wgVisualEditorNamespaces=array_merge($wgContentNamespaces,array( NS_USER ));

    localsettings.js:

    'use strict';

    exports.setup = function(parsoidConfig) {

        parsoidConfig.setMwApi('fgo', { uri: 'http://wiki.riesa.me/api.php' });
    

    };

    config.yaml:

    mwApis: - # This is the only required parameter,

          # the URL of you MediaWiki API endpoint.
    
          uri: 'http://wiki.riesa.me/api.php'
    
          # The "domain" is used for communication with Visual Editor
    
          # and RESTBase.  It defaults to the hostname portion of
    
          # the `uri` property above, but you can manually set it
    
          # to an arbitrary string. It must match the "domain" set
    
          # in $wgVirtualRestConfig.
    
          domain: 'wiki.riesa.me'  # optional
    
          # 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:  # optional
    
          #        'X-Forwarded-Proto': 'https'
    
          # See below, defaults to true.
    
          #strictSSL: false
    
    11 条回复    2018-05-09 22:09:52 +08:00
    AaronLee
        1
    AaronLee  
       2018-05-09 07:52:23 +08:00 via Android   ❤️ 1
    RiESA
        2
    RiESA  
    OP
       2018-05-09 08:25:54 +08:00
    @AaronLee 感谢感谢,终于有人回复了,MW 相关的资料太难找了

    看了一下您发的链接,好像是比我之前看的文章多了一个 Heroku 的步骤,但是英文文档比较难理解,不过我今天会再努力试一下看看的,如果您有时间给予适当指导就就更好了

    另外可以问一下您使用的 WM 具体版本是多少吗?
    AaronLee
        3
    AaronLee  
       2018-05-09 09:52:40 +08:00 via Android   ❤️ 1
    Mediawiki1.27 ,1.30 都用过,我是在虚拟机中安装 Ubuntu16.04 ,部署 Heroku 运行环境,用 git 将软件克隆下来,修改,部署到 Heroku
    RiESA
        4
    RiESA  
    OP
       2018-05-09 10:10:33 +08:00
    @AaronLee 部署了好几次 Heroku ,打开一直是 Application error,您有遇到过类似的情况吗?
    AaronLee
        5
    AaronLee  
       2018-05-09 10:29:57 +08:00 via Android   ❤️ 1
    我没有遇到过,你用的是什么系统?
    RiESA
        6
    RiESA  
    OP
       2018-05-09 15:54:41 +08:00
    @AaronLee

    wiki 网站是运行在 CentOS 7 x64 上的

    使用自己搭建的 parsoid 和 Heroku 的,都无法连接成功,出现 404 错误

    https://pacific-sierra-54198.herokuapp.com

    parsoid 我感觉是正常的,问题在于 VisualEditor 无法连接上去,附上 LocalSettings.php 配置内容,您过目一下有没有错误的地方



    wfLoadExtension( 'VisualEditor' );


    $wgDefaultUserOptions['visualeditor-enable'] = 1;


    // $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";


    $wgHiddenPrefs[] = 'visualeditor-enable';


    #$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

    $wgVirtualRestConfig['modules']['parsoid'] = array(

    'url' => 'https://pacific-sierra-54198.herokuapp.com',

    'domain' => 'localhost',

    'prefix' => 'fgo,

    'forwardCookies' => true
    );
    AaronLee
        7
    AaronLee  
       2018-05-09 17:46:01 +08:00   ❤️ 1
    'url' => 'https://pacific-sierra-54198.herokuapp.com',
    改成 'url' => 'pacific-sierra-54198.herokuapp.com',
    'prefix' => 'fgo,少个引号,改成'prefix' => '你网站的域名‘, 不要带 https://
    RiESA
        8
    RiESA  
    OP
       2018-05-09 18:40:38 +08:00
    @AaronLee

    // Parsoid configuration

    $wgVirtualRestConfig['modules']['parsoid'] = array(

    // URL to the Parsoid instance

    // Use port 8142 if you use the Debian package

    // url must not end in a slash, otherwise it might give a 404 error

    'url' => 'pacific-sierra-54198.herokuapp.com',

    // Parsoid "domain", see below (optional)

    'domain' => 'localhost',

    // Parsoid "prefix", see below (optional)

    'prefix' => 'wiki.riesa.me',

    //If you run a private wiki then you have to set the following variable to true:

    'forwardCookies' => true

    );


    难过,逐字检查后再试了一次,还是 GG 了

    从服务器加载数据时出错:apierror-visualeditor-docserver-http: HTTP 406。想要重试吗?

    点击重试后变成

    从服务器加载数据时出错:oldidnotfound: There is no revision with ID 0.。想要重试吗?


    会不会和 config.yaml 有关呢,parsoid 的打算先不动了,打算建个 1.30 的版本排查一下是不是版本原因
    AaronLee
        9
    AaronLee  
       2018-05-09 18:53:52 +08:00 via Android   ❤️ 1
    在部署到 Heroku 之前,你需要用 git 克隆下来,
    1,打开你 git 的软件的文件,选择显示隐藏的文件,修改
    2,将你网站的域名添加到 config.yaml
    建议你认真阅读发的那个教程
    AaronLee
        10
    AaronLee  
       2018-05-09 18:55:58 +08:00 via Android
    我只用 1.27 和 1.30 版本试过,
    RiESA
        11
    RiESA  
    OP
       2018-05-09 22:09:52 +08:00
    @AaronLee 感谢一直以来的解答,多次尝试之后依然无法正常使用

    正当我准备放弃将这几个通宵的努力化为泡影的时候

    看到了这个链接

    https://www.mediawiki.org/wiki/Topic:Ua42lnptxq4056ki

    按其中的一个回复操作,将 parsoid 内 lib/config/ParsoidConfig.js

    ParsoidConfig.prototype.strictAcceptCheck 这一值设置成 false 后成功运行了

    终于也是处理好了,同样也感谢您一直以来的耐心

    PS:拉到最下面有看到一句中文,而且还是近期的,哈哈哈,看来不是我一个人遇到这么坑爹的事情
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2054 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 472ms · UTC 01:39 · PVG 09:39 · LAX 18:39 · JFK 21:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.