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

i'm trying to set up a dev environment with apache2.2 + tomcat + mysql.

Of course i already have apache2.2 + mysql working fine with php but, when i look at google about how to setup tomcat, i find a lot of confusion.

Someone uses proxy, someone rewriterules and so on...

Could you please give me some info/links about how to accomplish this task?

Bests, Andrea

share|improve this question

1 Answer 1

I serve multiple apps off of one Tomcat instance and proxy them through Apache on the same box as virtual hosts.

Here is my basic configuration for Apache. The Tomcat instance is left nearly in defaults (only minimal modifications for security). You'll need to enable mod-proxy_ajp in Apache and configuration virtual hosts. This is a copy and paste of my config so there is SSL stuff in there too.

<VirtualHost *:443>
    ServerName  www.yourdomain.com

    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/yourdomain.pem

    RewriteEngine On
    RewriteRule ^/yourappname/(.*)$ https://www.yourdomain.com/$1 [L]

    ProxyPreserveHost   On

    ProxyPass / ajp://localhost:8009/yourappname/
    ProxyPassReverse / ajp://localhost:8009/yourappname/

    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>

    ErrorLog /var/log/apache2/www.yourdomain.com-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/www.yourdomain.com-access.log combined
    ServerSignature Off
</VirtualHost>
share|improve this answer
    
See the following link for information about getting the cookie to proxy correctly (not in the URL). I have not modified my config for this yet, but plan to do it in development soon. serverfault.com/questions/133404/… –  J.Zimmerman Apr 30 '10 at 0:11
    
Thanks dude, i really appreciate :) –  Andrea Baccega May 1 '10 at 11:17
    
Thanks a lot, wish I could upvote this more than once! –  Michael Wiles Dec 19 '11 at 11:55

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.