简体   繁体   English

Apache:客户端和服务器在同一个 VPS

[英]Apache: client and server on same VPS

I am wondering if it is okay to serve both, client and api under one domain?我想知道是否可以在一个域下同时服务客户端和 api? For example: index.html at my-vps.supplier.net and my-vps.supplier.net:3000 for api served by NodeJS?例如: index.htmlmy-vps.supplier.netmy-vps.supplier.net:3000为 NodeJS 服务的 api?

Is it even okay to expose api in such way?以这种方式暴露 api 甚至可以吗?

You can use apache reverse proxy (or another balancing technology) to expose the api on port 80 but on a different domain or on the same domain but under a different path.您可以使用 apache 反向代理(或其他平衡技术)将 api 暴露在端口 80 上但在不同的域上或在同一域上但在不同的路径下。

For apache Reverse Proxy: https://httpd.apache.org/docs/current/mod/mod_proxy.html For apache Reverse Proxy: https://httpd.apache.org/docs/current/mod/mod_proxy.html

For HAPropxy: http://cbonte.github.io/haproxy-dconv/2.4/intro.html对于HAPropxy: http://cbonte.github.io/haproxy-dconv/2.4/intro.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM