4

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

3

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>
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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