proxypass – Redirect domain.com/path to another Apache Server – Stack Overflow

Viewed 3k times

0

1

I have 3 Apache VM’s running currently:

A) ProxyPass (Hosts Nothing)
B) Main Website
C) ZoneMinder Website

If you access example.com you get to the website, and can navigate around, but…

If I manually type http://example.com/zm trying to access zoneminder

It redirects http://example.com/zm in my remote browser to http://192.168.1.255:443/foo*

I can’t seem to get my redirect working correctly, can anybody see what I am doing wrong?

Configs:

A) ProxyPass Server:

<VirtualHost *:80>
    ServerName          www.example.com
    RedirectPermanent / http://example.com
</VirtualHost>

<VirtualHost *:80>
ServerName example.com
ProxyRequests Off
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass / http://192.168.1.255:80/
ProxyPassReverse / http://192.168.1.255:80/
<Location />
    Order allow,deny
    Allow from all
</Location>
</VirtualHost>

B) Main Website

<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/example.log
CustomLog ${APACHE_LOG_DIR}/example-access.log combined
</VirtualHost>

0

Got it working!

The setup:

Server A) Apache server that only serves proxypass and doesn’t host anything

Server B) Apache server that hosts main domain.com

Server C) Apache server that hosts ZoneMinder @ domain.com/zm

Server A Config:

<VirtualHost *:80>
ServerName domain.com
Redirect / https://www.domain.com/
</VirtualHost>

<VirtualHost *:443>
ServerName www.domain.com
ProxyRequests Off
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
SSLProxyEngine On
SSLProxyCheckPeerCN on
SSLProxyCheckPeerExpire on
SSLEngine on
SSLCertificateFile /location of .crt
SSLCertificateKeyFile /location of .key
SSLCACertificateFile /location of .crt
ProxyPreserveHost on

ProxyPass /zm https://192.168.1.43:443/zm
ProxyPassReverse /zm https://192.168.1.43:443/zm


ProxyPass / https://192.168.1.42:443/
ProxyPassReverse / https://192.168.1.42:443/

<Location />
    Order allow,deny
    Allow from all
</Location>
</VirtualHost>

Notes: It is important to have the /zm come before the “/” catch all. I also noticed it FAILED if i used /zm/.

 

Source: proxypass – Redirect domain.com/path to another Apache Server – Stack Overflow

DNS on Ubuntu 18.04

For years it’s been simple to set up DNS on a Linux machine. Just add a couple of entries to /etc/resolv.conf and you’re done.

# Use Google's public DNS servers.
nameserver 8.8.4.4
nameserver 8.8.8.8

But things change and now it’s not that simple. If you now edit /etc/resolv.conf on Ubuntu you’ll find that the edits are ephemeral. If you restart (or even hibernate) your machine then they’ll be overwritten by default content.

nameserver 127.0.0.53
search Home

This is pretty simple to fix though.

  1. Install the resolvconf package.
sudo apt install resolvconf
  1. Edit /etc/resolvconf/resolv.conf.d/head and add the following:
# Make edits to /etc/resolvconf/resolv.conf.d/head.
nameserver 8.8.4.4
nameserver 8.8.8.8
  1. Restart the resolvconf service.
sudo service resolvconf restart

Fix should be permanent.

 

Source: DNS on Ubuntu 18.04 – datawookie