Skip to main content

Apache reverse proxy to node.js server?

Comments

4 comments

  • cPanelMichael
    We have confirmed that the node.js app is available at 30026. Port 80 is still just loading the Apache default landing page. We need to know how to forward all traffic that lands on port 80 to our 30026 port (node.js app).

    Hello @bbessembinders, The third example you noted seems to work based on a customer report on the thread you linked: Can you confirm that you used that method and the default Apache page still loads? Have you tried using "http" for the destination URL like the example instead of "https" as listed in the output you provided? Thank you.
    0
  • bbessembinders
    Update: I had tried making changes to the config file with variations of http and https and Apache was still loading the index page, but the site was not forwarding traffic through to the proxy port after restarting the httpd service. I was looking in the config file "/usr/local/apache/conf/httpd.conf" and noticed that there is a setting in the config file for the Host IP that captures all traffic on port 443.
    It looks like the HostIP VirtualHost directive supersedes any other directives from the sharedIP . Any changes that were made to the .27 VirtualHost external configuration file were not taking effect. I added the proxy settings to the HostIP external configuration file "/etc/apache2/conf.d/includes/post_virtualhost_global.conf" and the settings change does appear to have taken effect (The following code broke the Apache index page). ProxyPass / http://localhost:3001/ ProxyPassReverse / http://localhost:3001/
    I made the following changes and the Apache index page is loading, but it is still not passing traffic to the desired port. I will need to continue to make adjustments to see if I can get the incoming traffic to pass to the desired port. ServerName example.org SSLProxyEngine on ProxyPass / http://localhost:30026/ ProxyPassReverse / http://localhost:30026/
    Thanks for the suggestions. Any input is appreciated. I will update any progress made going forward.
    0
  • cPanelMichael
    Hello @bbessembinders, You may also want to try adding the custom rules to all virtual hosts (instead of in the global post virtual host include) using the Apply to all virtual hosts on the system steps at: Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation Thank you.
    0
  • digital_pig
    I just came across this post so wanted to add some feedback. The way you're going about this is wrong. You shouldn't be trying to "run" your app in production, you should be building your app "for" production. You can achieve this by using
    0

Please sign in to leave a comment.