Apache反向代理到CentOS 7(WHM)上的nodejs服务器

问题描述 投票:0回答:1

我正在尝试在服务器上设置我的网站。我已经上传了它,并且它当前正在服务器上运行,但是当我尝试在域上设置反向代理以便可以访问该站点时,问题就来了。我遵循了WHM文档中有关如何执行反向代理的说明,它虽然有效,但它也重定向了子域。以下是我用来修改单个虚拟主机的教程。

https://docs.cpanel.net/ea4/apache/modify-apache-virtual-hosts-with-include-files/

简而言之,我希望能够访问mt网站example.com,而不会影响我的子域webmail.example.com。下面是我的配置文件

   ServerName example.com
    ServerAlias www.example.com

    ProxyRequests Off
    <Proxy *>
       Require all granted
    </Proxy>

   ProxyPass / http://127.0.0.1:3000/
   ProxyPassReverse / http://127.0.0.1:3000/
node.js apache reverse-proxy centos7 virtualhost
1个回答
0
投票

您可以在ProxyPass中使用node-js上下文,因此它不会影响apache httpd中的任何其他部分。即

ProxyPass /Node-jsContext http://127.0.0.1:3000/Node-jsContext
ProxyPassReverse /Node-jsContext http://127.0.0.1:3000/Node-jsContext

这里Node-jsContext-是部署在NodeJS服务器上的应用程序的上下文根。

© www.soinside.com 2019 - 2024. All rights reserved.