wordpress 和 node.js [英] wordpress and node.js

查看:34
本文介绍了wordpress 和 node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在同一台服务器机器上安装 wordpress 和 node.js 服务器并使用 node.js 中的 wordpress mysql 数据库?是否也可以在服务器上安装 noSql 以与 node.js 一起使用?我想为我的门户使用 wordpress 作为前端,但所有异步工作都与 node.js 和从 wordpress mysql 读取一些数据并将一些数据写入 noSql 有关.有人可以帮助我完成测试的步骤.

Is it possible to install wordpress and node.js server on same server maschine and use wordpress mysql database also from node.js? Also is it possible to have noSql also installed on thah server to use with node.js? I want to use wordpress for frontend for my portal, but all asynchronous work to do with node.js and reading some data from wordpress mysql and writing some to noSql. Can someone please help me with steps how to achive this for testing purposes.

感谢您的宝贵时间和问候!

Thank you for your time and best regards!

推荐答案

如果你打算使用 node 来被 wordpress 提供的 JavaScript 异步访问,那么让它们运行会让你的生活变得更加轻松相同的主机和端口.我过去所做的设置如下:

If you're planning on using node for being accessed asynchronously by JavaScript that's being served by wordpress, then it will make your life considerably easier to have them running on the same host and port. What I've done in the past is set up the following:

  1. Apache + PHP + Wordpress 在某个端口(8000?)上运行
  2. Node + npm + 你想在其他端口(9000?)上运行的任何其他包
  3. 具有一些规则的 HAProxy 在端口 80 上侦听,这些规则将根据将请求发送到两个服务器中的哪一个的路径来决定.
  4. 正常安装 MySQL 和您选择的任何 NoSQL DB.

如果您想对端口 443 上的 HTTPS 执行相同操作,最新版本的 HAProxy 也可以终止 SSL.

Recent versions of HAProxy can also terminate SSL, if you want to do the same with HTTPS on port 443.

这是一个示例 HAProxy 配置:

Here's a sample HAProxy configuration:

defaults
  log global
  maxconn 4096
  mode http
  option http-server-close
  timeout connect 5s
  timeout client 30s
  timeout server 30s

frontend public
  # HTTP
  bind :80
  use_backend node if { path_beg /services }
  # Everything else to Apache.
  default_backend apache

backend node
  server node1 127.0.0.1:9000

backend apache
  server apache1 127.0.0.1:8000

这篇关于wordpress 和 node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆