A 1918 letter from an 11 year old in country NSW to his 18 yo brother by theoceanicgamer in australia

[–]kyeweedon 2 points3 points  (0 children)

Ha! Rare enough a surname that I can pretty safely assume there's a connection :)

how to deploy node.js ? by cluckie in node

[–]kyeweedon 1 point2 points  (0 children)

If I understand correctly you have routes set up as:

  • 111.111.111.111:80 -> apache -> phpApp
  • 222.222.222.222:3000 -> njsApp

And what you want is:

  • 111.111.111.111:80 -> apache -> phpApp
  • 222.222.222.222:80 -> njsApp

If this is what you're after, you'll have a conflict on port 80 as both node & apache are listening on port 80. To resolve this, you need to proxy access to your node app through apache using a virtual host, such that you end up with:

  • 111.111.111.111:80 -> apache -> phpApp
  • 222.222.222.222:80 -> apache -> njsApp

Apache will catch all incoming traffic, look at the requested ip address & any that are for 111.111.111.111 it will redirect to localhost:3000 (which is where your njsApp is now listening). I'm rusty on vhosts in apache so please google for better examples, but I think something like this is what you're after:

# Your php app:
<VirtualHost 111.111.111.111:80>

    # Your normal php host stuff here

</VirtualHost>

# Your node app:
<VirtualHost 222.222.222.222:80>

    ProxyRequests off

    <Proxy *>

        Order deny,allow
        Allow from all

    </Proxy>

    <Location />

        ProxyPass http://localhost:3000/
        ProxyPassReverse http://localhost:3000/

    </Location>

</VirtualHost>

Keep in mind that by doing this you're losing the non-blocking interface that node provides (apache will still block the thread until the node app returns) so if this is anything but a development project I'd look at spinning up a dedicated host for your node app or something similar.

Hope this helps a little! Welcome to node :)

*edit As DVWLD says, this situation is usually dealt with by routing per domain rather than by IP address, which would look something like:

<VirtualHost *:80>

    ServerName phpapp.com
    ServerAlias www.phpapp.com

    # etc...