Skip to content

WHM Easy Apache 4 Hypnotoad with Unix Sockets

Eugen Konkov edited this page Jun 5, 2019 · 2 revisions

This page describes the process of manually configuring a Mojo Hypnotoad application using unix socket to run behind a Virtual Domain Apache configuration within a current version of cPANEL WHM.

Performed entirely through shell and assumes that you are the administrator of the WHM Server with admin/root access.

Configuring the customisation of the Virtual Host proxy can also be done through the WHM web console as described in the cPanel EA4 Docs

Configure the user-space mojo application to listen on a unix socket file.

$PATH_TO_UNIX_SOCKET_FILE = "%2Fhome%2Fcpanel_username%2Fmy.sock";
app->config(
  hypnotoad => {
    listen => ["http+unix:$PATH_TO_UNIX_SOCKET_FILE"],
  }
);

Then launch using hypnotoad myapp.pl

NB - depending on your configuration you may need to grant permissions on the .sock file

Configure Proxy for a specific user domain

Create the path subdirectories beneath for /etc/apache2/conf.d/ conf file for user

nano /etc/apache2/conf.d/userdata/ssl/2_4/$CPANEL_USERNAME/$CPANEL_USER_DOMAIN/mojo.conf

## add the proxy httpd conf configuration in a format similar to 
ProxyPass / unix:$PATH_TO_UNIX_SOCKET_FILE|http://$CPANEL_USER_DOMAIN/
ProxyPassReverse / unix:$PATH_TO_UNIX_SOCKET_FILE|http://$CPANEL_USER_DOMAIN/

NB: replace appropriate values above into $CPANEL_USERNAME $CPANEL_USER_DOMAIN $PATH_TO_UNIX_SOCKET_FILE

Rebuild HTTPD Configuration and Restart Apache

/usr/local/cpanel/scripts/rebuildhttpdconf

Re-start Apache

/usr/local/cpanel/scripts/restartsrv_httpd
Clone this wiki locally