1

I'm currently interested in playing with node, so I want to build a small app for my company. We have an apache web server that handles our current web applications. My question is, how can I also host a node application on this same server, without having to make users of the app enter a port number? IE:

My main server ip is: 123.456.789

myapp.com/ -> goes to main server (port 80) mynodeapp.com/ -> goes to main server (but the app is running on port 3000)

How do I get mynodeapp.com to go to that main server but know to use port 3000 (without having my users enter the port in the url)?

I'm assuming I have to let the traffic come in on port 80 as it would, and let apache redirect? Thanks, I'm no server admin, and I know just enough to get me in trouble :)

1 Answer 1

0
# The *:80 part must match the config of your existing virtual host(s), and
# a NameVirtualHost directive in your main config somewhere.
<VirtualHost *:80>
   # This determines what requests get sent to this virtual host:
   ServerName mynodeapp.com
   # Proxy all requests to the port 3000 listener:
   ProxyPass / http://127.0.0.1:3000/
   # This handles the translation of the location header in 30x responses:
   ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>

If your existing config isn't using virtual hosts, you'll need some other adjustments first - provide more details about the existing config and we can assist.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .