I have a non-Apache server listening to port 8001 and Apache listening port 80. I want a certain virtual domain to actually be served by the non-Apache server over port 80.
Example:
<VirtualHost *:80> Servername example.com # Forward this on to the server on port 8001 </VirtualHost>
I thought I could do this with mod_proxy and ProxyPass with something like this.
ProxyPass * http://www.example.com:8001/
But that doesn't work.
In addition to being a "basic" web server, and providing static and dynamic content to end-users, Apache httpd (as well as most other web servers) can also act as a reverse proxy server, also-known-as a "gateway" server.
Apache HTTP Proxy is a proxy service that can be used to distribute updates to client computers. Apache HTTP Proxy performs a similar role to the mirror server feature popular in ERA 5 and earlier. To install Apache HTTP Proxy, read the instructions for Windows, Linux, or Virtual Appliance.
Apache Working As A Reverse-Proxy Using mod_proxy Some of these modules are: mod_proxy: The main proxy module for Apache that manages connections and redirects them. mod_proxy_http: This module implements the proxy features for HTTP and HTTPS protocols. mod_proxy_ftp: This module does the same but for FTP protocol.
The Apache reverse proxy handles the incoming request, recognizes that an Apache ProxyPassReverse setting exists, and then forwards the request to Tomcat. Then Tomcat handles the request, returns a response to the Apache reverse proxy, and Apache returns the response to the client.
ProxyPass * http://www.example.com:8001/
star is only valid in a block. Forward slash is what you want.
ProxyPass / http://www.example.com:8001/ ProxyPassReverse / http://www.example.com:8001/
The reverse proxy ensures that redirects sent by your port 8001 server are adjusted to the canonical name name of your proxy.
The apache manual has some examples. http://httpd.apache.org/docs/2.0/mod/mod_proxy.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With