简体   繁体   English

在相同的域和“ URL”上运行Node.js和Apache

[英]Running both Node.js and Apache on the same domain and “URL”

Is it possible to run Both node and Apache on the same domain without adding the port in the URL ? 是否可以在同一域上运行节点和Apache,而无需在URL中添加端口? and serve both on the same page, i already have node running on port 8443 and Apache on port 433 and they both work fine but i need to specify in the link the port "8443" to access node which is not what i want, i want to serve both on the same URL if possible without adding the port to the URL. 并在同一页面上提供服务,我已经在8443端口上运行了节点,在433端口上运行了Apache,它们都工作正常,但是我需要在链接中指定端口“ 8443”以访问不是我想要的节点,我希望在可能的情况下都在同一URL上提供这两种服务,而无需将端口添加到URL。

You can set an nginx proxy before them and separate routes to apache or node. 您可以在它们之前设置一个nginx代理,并分隔到apache或node的路由。

https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/ https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

You can use Apache reverse proxy 您可以使用Apache反向代理

Add this configuration to your apache conf. 将此配置添加到您的apache conf中。

ProxyPass "/nodeapp" "http:/localhost:8443"

You can access node application by http://www.example.com/nodeapp 您可以通过http://www.example.com/nodeapp访问节点应用程序

A reverse proxy is a type of proxy server that retrieves resources on behalf of a client from server. 反向代理是一种代理服务器,它代表客户端从服务器检索资源。 These resources are then returned to the client as if they originated from the web server itself. 然后将这些资源返回给客户端,就好像它们源自Web服务器本身一样。

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

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