Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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>
share|improve this question
    
What is in apache access and error log? What do you see in browser, when accessing the reverse proxy web? –  Kamil Šrot Nov 14 '12 at 18:41
    
@KamilŠrot I see nothing. As if nothing happens, I just see empty dir. –  Sandro Dzneladze Nov 14 '12 at 18:47
    
Make sure, you load mod_proxy and mod_proxy_http, check error.log –  Kamil Šrot Nov 14 '12 at 18:52

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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>
share|improve this answer
    
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. –  Josh Wieder Dec 23 '14 at 16:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.