简体   繁体   中英

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 ? 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.

You can set an nginx proxy before them and separate routes to apache or node.

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

You can use Apache reverse proxy

Add this configuration to your apache conf.

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

You can access node application by 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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