【问题标题】:How to use node js and python on same domain?如何在同一域上使用节点 js 和 python?
【发布时间】:2017-05-03 06:44:27
【问题描述】:

我已经在 python (Webapp2) 中创建了我的项目,但我想在节点 js 中创建管理面板并将其设置在同一目录中。

我面临如何从 url 路由节点 app.js 的问题

【问题讨论】:

    标签: python-2.7 express webapp2


    【解决方案1】:

    Docker 是最好的选择。 使用 docker 并创建三个容器(nginx、nodejs、Webapp2)。

    for nodejs, use port like 8080
    for Webapp2, use port like 8000
    

    在 docker-compose.yml 中将 nodejs 和 Webapp2 与 ngninx 链接并配置 nginx.conf 文件。

    像使用 nginx.conf 一样

    location /dashboard {
        proxy_pass http://nodejs:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    location / {
        proxy_pass http://webapp2:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    

    【讨论】:

    • 感谢您的回答。如果我想在谷歌云应用引擎上同时部署 node js 和 webapp2,那么我将如何管理?例如lynkweb-165106.appspot.com我有这个域我将如何在它上面运行节点js和python代码谢谢
    • 我将如何在谷歌应用引擎的同一域上同时使用 python 和 node js?
    猜你喜欢
    • 2018-09-22
    • 1970-01-01
    • 2013-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-21
    • 2017-03-19
    • 1970-01-01
    相关资源
    最近更新 更多