logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache proxy/redirect to same domain
Author
jnojr



Joined: 19 May 2024
Posts: 1
Location: USA - AZ - Chandler

PostPosted: Sun 19 May '24 20:42    Post subject: Apache proxy/redirect to same domain Reply with quote

I have a website www.example.com on a hosting provider. We use that provider because it has a simple site builder my wife uses to maintain the site. Moving off of it isn't an option for this exercise.

I want to create an Apache proxy that can accept traffic for www.example.com that will simply pass all requests along to that hosted site, which is a vhost so hostname must be retained. I want to do this so I can use that proxy to add TLS (the hosting provider won't let us without charging triple - yes, they suck, but again, leaving isn't an option).

What I've got so far:

Code:
<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias exxample.com
    RequestHeader set Host "www.example.com"
    ProxyPreserveHost on
    ProxyPass / http://192.168.193.133 # IP of providers vhost
    ProxyPassreverse / http://192.168.193.133
</VirtualHost>


Once I get this working with HTTP I should be able to add TLS!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7334
Location: Germany, Next to Hamburg

PostPosted: Tue 21 May '24 9:56    Post subject: Reply with quote

Code:

<VirtualHost *:443>
   ServerName example.com
   DocumentRoot /home/empy/www

   <Directory /home/empy/www>
      Options FollowSymLinks
      AllowOverride None
      Require all granted
   </Directory>

   SSLProxyEngine on
   ProxyPass / http://192.168.193.133/
   ProxyPassReverse / http://192.168.193.133/
   ErrorDocument 503 /home/empy/www/HTTP503.html

   ErrorLog /opt/apache2/logs/example.com.error.log
   TransferLog /opt/apache2/logs/example.com.access.log

   SSLEngine on
   SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
   SSLCertificateKeyFile /etc/letsencrypt/live/example.comprivkey.pem
</VirtualHost>
Back to top


Reply to topic   Topic: Apache proxy/redirect to same domain View previous topic :: View next topic
Post new topic   Forum Index -> Apache