Saturday, January 8, 2022

[SOLVED] Run NodeJS app on httpd subdomain

Issue

Thanks in advance for your help,

I want to launch a nodeJS application through httpd (RedHat) in a server that has a lot of VirtualHosts, so I went to the httpd conf file located at /etc/httpd/conf/httpd.conf and added in the end of the file the following configuration:

<VirtualHost *:80>
  ServerName subdomain.example.com
  ProxyPreserveHost on
  ProxyPass / http://localhost:8080/
</VirtualHost>

My NodeJS app is running on localhost:8080 but when I go to subdomain.example.com I am just getting a Server Not found error. Tried a lot of combinaisons in the httpd config file that I have found in the internet but in vain. I restart the httpd service everytime I did a change to the config file by running service httpd restart


Solution

This was only a DNS propagation issue. Fixed by adding an A record to the DNS entries.



Answered By - Mehdi Benmoha