Question
What is an Apache Reverse Proxy? What do I need to do to create one?
Answer
A reverse proxy receives a client's requests for a website, redirects those requests to a different destination, such as a different port, and returns the content at that destination as if it were the original destination requested by the client.
This is useful for forwarding requests to an application other than Apache, or another server, while still using Apache to serve requests. Node.js is commonly configured this way, with Node running as a service, and a Reverse Proxy setup in Apache to handle HTTP and HTTPS requests.
To utilize mod_proxy, you'll need root access.
- Create the directories and files where the includes go:
mkdir -p /etc/apache2/conf.d/userdata/ssl/2_4/CPANELUSERNAME/DOMAIN.TLD/
mkdir -p /etc/apache2/conf.d/userdata/std/2_4/CPANELUSERNAME/DOMAIN.TLD/
touch /etc/apache2/conf.d/userdata/ssl/2_4/CPANELUSERNAME/DOMAIN.TLD/include.conf
touch /etc/apache2/conf.d/userdata/std/2_4/CPANELUSERNAME/DOMAIN.TLD/include.conf
Please note, that CPANELUSERNAME is the cPanel username and DOMAIN.TLD is the domain you're configuring.
- Open both include.conf files in your preferred text editor, and add the following:
ProxyPass /.well-known !
ProxyPass / http://ip:port/
ProxyPassReverse / http://ip:port/
Please note, in the above example, ip is the IP address you're proxying to, and port is the port number.
Resources
How to use Apache Includes to add Configuration Directives to a specific domain's VirtualHost
Comments
0 comments
Article is closed for comments.