1

I've subsonic application running of tomcat. Everything else works on apache. I don't want to write port number everytime so I'd like to set-up a simple directory where subsonic will be accessible.

So, I'm trying to make virtualhost file inside apache dir. (ubuntu server 12.04)

I tried many variations, but cannot make anything work:

<VirtualHost *:80>

 DocumentRoot /var/www/streamer

  ProxyPass               /       http://mini.local:4040/
  ProxyPassReverse        /       http://mini.local:4040/

</VirtualHost>
3
  • What is in apache access and error log? What do you see in browser, when accessing the reverse proxy web? Nov 14, 2012 at 18:41
  • @KamilŠrot I see nothing. As if nothing happens, I just see empty dir.
    – user113400
    Nov 14, 2012 at 18:47
  • Make sure, you load mod_proxy and mod_proxy_http, check error.log Nov 14, 2012 at 18:52

2 Answers 2

2

What you are doing should already work. I do have similar setup where the tomcat is running 8080 and I dont want external URL(hence the end user should never know I am running it on 8080).

So I do is do proxypass similar to what you did and also use redirect match or redict permanent in case my internal URL changes. Example if I change from http to https and dont want to change the URL on the client APIs or other applications.

You should try to use the apache redirect module. It would allow you to internally redirect without modifying the external URL

Example:

<VirtualHost *:80>
  ServerName test.web.site
  Redirect permanent / http://another.site.port
</VirtualHost>

Above example will be addition to what you are already doing using ProxyPass.

1

You may want to consider something like this. Its been a while since I've used Tomcat, but I do something very similar for a node.js application. In my scenario, the document root is taken care of by node - that may be the case with your Tomcat configuration as well, but you can test and if not, pretty easily just add a DocumentRoot imperative as needed.

<VirtualHost *:80>
    ServerName mini.local
    ProxyRequests Off
    ProxyPreserveHost On
    <Proxy *>
            AddDefaultCharset Off
            Order deny,allow
            Allow from all
    </Proxy>
    ProxyPass / http://mini.local:4040/
    ProxyPassReverse / http://mini.local:4040/
 </VirtualHost>
1
  • I should mention that even with a Proxy config, if you want to configure the server such that the hostname:port# URL will never be visible, you will probably need to use mod_rewrite in addition to Proxy. Dec 23, 2014 at 16:11

You must log in to answer this question.