Prerender不会返回页面响应

时间:2016-05-24 01:56:32

标签: prerender

长话短说:

  1. 服务器操作系统得到更新,这打破了我的虚拟现实。在此之前一切正常。
  2. 重新安装环境。
  3. 尝试使用以下env变量启动Prerender.io中间件(通常由主管运行,现在手动尝试):
  4. `

    export PORT=35292
    export PRERENDER_SERVICE_URL='http://localhost:35292/'
    export PHANTOMJS_PORT=35294
    export PHANTOM_CLUSTER_NUM_WORKERS=5
    export PHANTOM_WORKER_ITERATIONS=10
    export CACHE_ROOT_DIR="/home/users/jz/snapshot-env/prerender/filecache/"
    export CACHE_LIVE_TIME=7200
    PHANTOM_CLUSTER_MESSAGE_TIMEOUT=800
    

    `

    1. 设置演示服务器demoserver.js
    2. `

      #!/usr/bin/env node
      var prerender = require('./lib');
      
      var server = prerender({
          workers: process.env.PRERENDER_NUM_WORKERS,
          iterations: process.env.PRERENDER_NUM_ITERATIONS
      });
      
      
      //server.use(prerender.sendPrerenderHeader());
      // server.use(prerender.basicAuth());
      // server.use(prerender.whitelist());
      server.use(prerender.blacklist());
      // server.use(prerender.logger());
      server.use(prerender.removeScriptTags());
      server.use(prerender.httpHeaders());
      // server.use(prerender.inMemoryHtmlCache());
      // server.use(prerender.s3HtmlCache());
      
      server.start();
      

      `

      1. 服务器启动:
      2. `

        $ node demoserver.js 
        2016-05-24T01:41:35.814Z starting worker thread #0
        2016-05-24T01:41:35.832Z starting worker thread #1
        2016-05-24T01:41:35.839Z starting worker thread #2
        2016-05-24T01:41:35.842Z starting worker thread #3
        2016-05-24T01:41:35.844Z starting worker thread #4
        2016-05-24T01:41:36.120Z starting phantom...
        2016-05-24T01:41:36.132Z Server running on port 35292
        2016-05-24T01:41:36.135Z starting phantom...
        2016-05-24T01:41:36.146Z starting phantom...
        2016-05-24T01:41:36.152Z Server running on port 35292
        2016-05-24T01:41:36.153Z starting phantom...
        2016-05-24T01:41:36.160Z Server running on port 35292
        2016-05-24T01:41:36.170Z Server running on port 35292
        2016-05-24T01:41:36.176Z starting phantom...
        2016-05-24T01:41:36.190Z Server running on port 35292
        Fontconfig warning: ignoring UTF-8: not a valid region tag
        Fontconfig warning: ignoring UTF-8: not a valid region tag
        Fontconfig warning: ignoring UTF-8: not a valid region tag
        Fontconfig warning: ignoring UTF-8: not a valid region tag
        Fontconfig warning: ignoring UTF-8: not a valid region tag
        

        `

        1. 尝试在本地访问服务器:
        2. $ lynx http://localhost:35292/http://google.com

          我看到它试图获取页面,但没有响应: HTTP请求已发送;等待回应。

          在服务器日志中,我看到它已收到请求:

          2016-05-24T01:53:42.449Z getting http://google.com/

          之后没有条目也没有动作。我看到prerender确实产生了几个phantomjs进程,但由于某种原因没有任何反应。

          任何想法如何进一步调试,以了解为什么phantomjs没有处理或返回请求?

          编辑:npm install output here - 看不到任何可疑的东西。

          (snapshot-env)jz@lakka:~/snapshot-env/prerender$ uname -a
          Linux lakka 3.14.66-grbfs-kapsi #1 SMP Sat Apr 16 10:30:24 EEST 2016 x86_64 GNU/Linux
          
          
          (snapshot-env)jz@lakka:~/snapshot-env/prerender$ cat /etc/*release
          PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
          NAME="Debian GNU/Linux"
          VERSION_ID="8"
          VERSION="8 (jessie)"
          ID=debian
          HOME_URL="http://www.debian.org/"
          SUPPORT_URL="http://www.debian.org/support"
          BUG_REPORT_URL="https://bugs.debian.org/"
          

          节点版本:

          jz@lakka:~$ cd snapshot-env;source bin/activate
          (snapshot-env)jz@lakka:~/snapshot-env$ node -v
          v6.2.0
          

1 个答案:

答案 0 :(得分:2)

嘿,我之前遇到过这个问题,我通过这些命令修复了

1。降级到节点4.x

sudo apt-get purge nodejs
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install nodejs

2。解决问题:Fontconfig warning: ignoring UTF-8: not a valid region tag

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8

那就是它。 希望它可以帮到你。

我重新安装了这项服务,并写了一篇显示流程的博客

查看http://ccaloha.cc/blog/2016/06/22/how-to-install-preloader-dot-io-service-in-ubuntu-14-dot-04/