I have to put nodejs in port 80, but apache is already using it. How can I put both (nodejs and apache) on the same port 80? I need it because in my university all the ports
You can also use Apache 2's mod_proxy and mod_proxy_http, which might be more reliable or perform better depending on your system.
Here's an example:
# Use Apache for requests to http://example.com/
# but use Node.js for requests to http://example.com/node/
ServerName example.com
DocumentRoot /var/www/example/
ProxyPass http://127.0.0.1:8124/
ProxyPassReverse http://127.0.0.1:8124/
And of course you can modify the directives to your needs, such as using a different port for your virtual host (e.g., 443), different port for Node.js, or set up the proxy under a different block, such as for a subdomain (e.g., node.example.com).