Suppose you are running a server/daemon as a normal user on a very high port number but you wish to serve the contents on an existing Apache web server. You can use Apache's
mod_proxy modules to proxy any requests made to Apache to your internal service.
An example use-case would be, if you ran a rails application on a cPanel account listening on
127.0.0.1:300 but you want to serve it on your primary domain.
If Apache has
mod_proxy_http support enabled, create a
.htaccess file with the following contents:
# Prevent errors about /index.html not found DirectoryIndex disabled # Use [P] to enable proxy RewriteEngine on RewriteRule ^(.*)$ http://127.0.0.1:3000/$1 [P,L]
With this file made, any requests made to your website will now be proxied by Apache.