Apache and Node.js on the Same Server

前端 未结 10 1716
青春惊慌失措
青春惊慌失措 2020-11-22 06:11

I want to use Node because it\'s swift, uses the same language I am using on the client side, and it\'s non-blocking by definition. But the guy who I hired to write the pro

10条回答
  •  深忆病人
    2020-11-22 06:58

    You can use a different approach such as writing a reverse proxy server with nodejs to proxy both apache and all other nodejs apps.

    First you need to make apache run on a different port other than port 80. ex: port 8080

    Then you can write a reverse proxy script with nodejs as:

    var proxy = require('redbird')({port: 80, xfwd: false);
    
    proxy.register("mydomain.me/blog", "http://mydomain.me:8080/blog");
    proxy.register("mydomain.me", "http://mydomain.me:3000");
    

    Following article describes the whole process of making this.

    RUN APACHE WITH NODE JS REVERSE PROXY – USING REDBIRD

提交回复
热议问题