0

I would like to send "sub-domain" traffice through 1 DMZ in my network. I have 1 fixed IP and send my domain requests to my server through my network. ie www.example.com goes to my x.x.x.x fixed ip and ends up in my home server 192.168.1.43. Now because that server (debian 10) is the only server in the DMZ i would like to forward server requests from there to an other server in my network ie 192.168.1.39. So in the dns I would still send traffic from the internet server2.example.com towards 192.168.1.43 but from there would like to send it on to 192.168.1.39

Does anyone have tips on the virtual hosts, or proxy settings in the apache2 configs?

Thanks!

Dennis B
  • 1
  • 2

1 Answers1

0

I think you are describing a reverse-proxy set up. Take a look at this guide for Apache https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

Nginx and HA Proxy are popular alternatives to Apache for this.

Dharman
  • 30,962
  • 25
  • 85
  • 135
johnmgn
  • 52
  • 1
  • Hi John, thanks for your answer. I have been looking for my config but although the picture in the link is my situation I cant find the correct example or settings. But it is indeed a reversed proxy with different internal IP-adresses where the traffic should be going, based on the initial domain name request. I also looked at HA-proxy but that loooks like a bit of overkill for me I think. – Dennis B Mar 09 '21 at 15:19
  • If you are looking for the settings, this should help. https://serverfault.com/questions/182830/how-to-setup-reverse-proxy-to-forward-domain-names-to-different-servers – johnmgn Mar 09 '21 at 16:37
  • Thanks for the answers, got it working! So no HA-proxy or Nginx just with Apache2 and it works smooth. – Dennis B Mar 10 '21 at 05:48
  • Hi all, I have got it to work but I am in kind of a new question; So the reverse proxy works fine but I cant seam to redirect different subdomains to their respective landing pages. No matter what i try they will all always end up in the same folder. Any thoughts on that? – Dennis B Mar 11 '21 at 21:54
  • You can add a DocumentRoot directive to each virtual host entry that will point to the directory that contains the relevant landing page. The format is "DocumentRoot /path/to/directory" – johnmgn Mar 13 '21 at 10:18
  • Thanks again John. I tried that but it ends up always in the same directory... I disabled the 000-default.conf and enabled the new ones. Same result. Here are my confs I sedn one because the other is copy except for the directory; ServerName mail.example.com ServerAlias mail.example.com ServerAdmin root@example.com DocumentRoot /var/www/mail ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine on Include /etc/letsencrypt/options-ssl-apache.conf – Dennis B Mar 13 '21 at 12:14