2

I currently have a Sub Domain Proxies and Sub Folder Proxies working as seperate virtual hosts.

I want to minimise/simplify the code by combining.

My end game is to have Subdomains pointing to different Physical/Virtual Servers, while use subfolders to access different services in that server.

For Example:

www.example.com = Server 0 Apache www.example.com/webmin = Server 0 Webmin server1.example.com = Server 1 Apache server1.example.com/webmin = Server 1 Webmin server1.example.com/ad = Server 1 Active Directory UI server2.example.com = Server 2 Apache server2.example.com/webmin = Server 2 Webmin server2.example.com/ad = Server 2 Active Directory UI 

I have the following working thou as separate VirtualHosts:

#NAS as nas.example.com ProxyPass / http://10.0.28.1:5000/ ProxyPassReverse / http://10.0.28.1:5000/ #Webmin as nas.example.com/webmin ProxyPass /webmin/ http://10.0.28.1:10000/ ProxyPassReverse /webmin/ http://10.0.28.1:10000/ 

My guess is the first entry is overriding the second as the first is /. I just can't seem to nut out how to override and make both ReverseProxies work within the same

3
  • ProxyPass directives are processed in order of the first match, simply list the one to the root / last rather than before /webmin/ if that is your problem. - But Apache httpd can easily handle 100’s if not more VirtualHost entries and you can use the Include directive to load a common section into all VirtualHost entries, so I am not quite clear what you want to simplify in your config. Commented Dec 22, 2017 at 6:14
  • I thought I tried changing the order, but will try again. I wanted to simplify for readability. I was thinking of using macros later too. I was just hoping to have a single virtual host setup per server keeping all its settings together. Commented Dec 22, 2017 at 7:05
  • Somewhat related: serverfault.com/questions/799012/… Commented Dec 22, 2017 at 10:28

1 Answer 1

1

Just tried reordering and it's still not working.

<VirtualHost *:443> # NAS ServerName nas.example.com ServerAdmin [email protected] DocumentRoot /mnt/WWW ProxyPass /webmin/ http://10.0.27.1:10000/ ProxyPassReverse /webmin/ http://10.0.27.1:10000/ ProxyPass / http://10.0.27.1:5000/ ProxyPassReverse / http://10.0.27.1:5000/ # SSL Certificates SSLEngine on SSLCertificateFile /root/ssl/example.com.crt SSLCertificateKeyFile /root/ssl/private.key SSLCACertificateFile /root/ssl/intermediateCA.crt # Error Logs ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 

The above is a reverse proxy to another server (the NAS). nas.example.com should be the NAS's default GUI while nas.example.com/webmin should point to Webmin on the same server (NAS). What is happening thou is /webmin returns a page from the NAS GUI saying the page cannot be found.

4
  • Update: I got it working. Changing /webmin/ to /webmin fixed it. But am having issues with the redirect. A page under the subfolder to any server (not just webmin) will try to get CSS, JS, IMG etc from the parent domain. Looking in the source shows nas.example.com/style.css when it should be nas.example.com/webmin/style.css I need to work out how to force the subfolder to be the parent of the reverse proxy. Commented Dec 22, 2017 at 7:29
  • That's usually a configuration issue on the application server. Commented Dec 22, 2017 at 7:39
  • serverfault.com/a/561897/37681 and the answer below mine for some thoughts on that Commented Dec 22, 2017 at 8:23
  • Will not work because Webmin server uses addresses starting with / that are related to the root of the Webmin server. We must rewrites urls, js, css in the pages served by the Webmin server. Commented Nov 6, 2023 at 12:24

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.