node.js - ExpressJS Server - respond to host header with shared port -


lets have corporatewebsite.com listening on port 80. appache / wordpress site.

i have node application i'd respond sub.corporatewebsite.com

the node application running express currently. can listen separate port @ moment, service won't start if it's pointed port 80 since it's in use.

how can have both apache , node listening port 80, having node responding subdomain?

you use reverse proxy nginx route subdomains.

here example of nginx configuration, might probaly have complete according project , server :

server {     listen          80;     server_name     corporatewebsite.com;      location / {         [ ... parameters ... ]         include         proxy_params; // import global configuration routes         proxy_pass      http://localhost:1234/; // 1 of server listens 1234     } }  server {     listen          80;     server_name     sub.corporatewebsite.com;      location / {         [ ... parameters ... ]         include         proxy_params;         proxy_pass      http://localhost:4567/; // other server listens 4567     } } 

you have configure, example, apache2 listening port 1234 while nodejs listening port 4567.

if this, practice block direct access outside ports 1234 , 4567 (using iptables example).

i think post useful : node.js + nginx - now?


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -