Avoid the conflict on port 80 between nodejs and apache

The goal is to listen on port 80 with nodejs without killing apache.

I have to say my knowledges in network are very basic.

UPDATE

I am trying to use ProxyPass ProxyPassReverse on my local machine but there is something wrong.

    Alias /test /media/www-dev/public/test
    <Directory /media/www-dev/public/test>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>

    ProxyRequests off

   <Proxy *>
      Order deny,allow
      Allow from all
   </Proxy>
   <Location />
     ProxyPass /test http://localhost:3000/
     ProxyPassReverse /test http://localhost:3000/
   </Location>

When i launch http://localhost/test on my browser i get a message Cannot GET /test/, if i stop to listen on the port 3000, then i get 503 Service Temporarily Unavailable my node app is listening on the port 3000.

If if commente the "Proxy" lines, i can reach the URL http://localhost/test again.

Why can i not access the URL http://localhost/test ? Is it because the proxy try to reach http://localhost:3000/ instead following the path of the alias /test ?

Thanks !

you need to create a virtual host in apache for your node app and proxy over the requests.

here is what mine looks like in /etc/apache/sites-available/dogself.com

<VirtualHost 69.164.218.75:80>
    ServerName dogself.com
    ServerAlias www.dogself.com
    DocumentRoot /srv/www/dogself.com/public_html/
    ErrorLog /srv/www/dogself.com/logs/error.log
    CustomLog /srv/www/dogself.com/logs/access.log combined

    ProxyRequests off

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    <Location />
        ProxyPass http://localhost:3000/
        ProxyPassReverse http://localhost:3000/
    </Location>

</VirtualHost>

It sounds like you have a lot to research before you can get this working though. start reading docs

Alternative approach for a virtual host would be the following

<VirtualHost *:80>
    ServerAdmin info@DOMAIN.com
    ServerName DOMAIN.com
    ServerAlias www.DOMAIN.com
    ProxyRequests off

    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    <Location />
            ProxyPass http://localhost:3000/
            ProxyPassReverse http://localhost:3000/
    </Location>

</VirtualHost>

To fix the Internal Server ERRROR just enable the right apache extension.

sudo a2enmod proxy_http
sudo service apache2 restart