How to set cPanel to use ProxyPass for Ruby or any other backend server apps?

ylluminate

Member
Apr 12, 2013
16
2
3
cPanel Access Level
Root Administrator
I have a Ruby app that needs to run on a cPanel host. I do have root access to the server.

I would like to be able to set a subdomain to utilize ProxyPass to allow me to run unicorn or any other server I wish for this Ruby app (and later I will be running nodejs apps), however the instructions here do not seem entirely clear.

For example, in the section "Custom Templates for Subdomains and Addon Domains", it notes that we should follow 3 steps, however to where do we copy the `vhost.default` or `ssl_vhost.default`? So for example, if I have example.tld, which runs fine normally on the default Apache cPanel setup, but I have another.example.tld that I want to pass through to a ruby backend, what precisely do I do?

I believe that it should be as simple as inserting

Code:
ProxyPass / http://127.0.0.1:3001
into this file once I figure out where it should go and then run an incantation like:

Code:
usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
Correct? I would very much appreciate some exact steps and configuration options that should go in the file as well if you are able to shed any additional light on the subject.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
Hello :)

If you are editing a single VirtualHost instead of editing the default template for new VirtualHosts, then you can follow the instructions at:

Changes Contained Within a VirtualHost Directive

Focus on the "Using Include Files" and "For an individual VirtualHost container" section of this document. After creating the file for the appropriate domain/username and version of Apache, you can insert your custom line to that file, and then run the following commands:

Code:
/usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
No additional steps are required, and the change you made should be active.

Thank you.