How to deploy multiple Grails apps on one Tomcat + Apache?

后端 未结 2 343
渐次进展
渐次进展 2021-02-02 01:09

I\'ve read the several questions on StackOverflow and googled several hours but I can\'t find a complete and clear answer to my problem of deploying multiple Grails apps on one

2条回答
  •  时光说笑
    2021-02-02 02:00

    I struggled with this a while back and managed to get something that works ok. It doesn't use mod_jk though, I opted for mod_proxy. I also had a slightly different set up in Tomcat (mine is version 6 btw), where I added multiple connectors as well as the Host declarations you have.

    Try the following -

    In tomcat server.xml:

    
    
    
    
    
    
    
      
                domain1.com
      
      
                domain2.com
      
    

    In Apache:

    
      ServerName www.domain1.com
      ServerAlias www.domain1.com
    
      ProxyRequests Off
    
      ErrorLog /var/log/apache2/error-domain1.log
    
      
            Order Allow,Deny
            Allow from all
      
    
      
        Order deny,allow
        Allow from all
      
      ProxyPass / http://localhost:8081/
      ProxyPassReverse / http://localhost:8081/
      ProxyPreserveHost On
    
    
    
      ServerName www.domain2.com
      ServerAlias www.domain2.com
    
      ProxyRequests Off
    
      ErrorLog /var/log/apache2/error-domain2.log
    
      
            Order Allow,Deny
            Allow from all
      
    
      
        Order deny,allow
        Allow from all
      
      ProxyPass / http://localhost:8082/
      ProxyPassReverse / http://localhost:8082/
      ProxyPreserveHost On
    
    

    Make sure mod_proxy is enable for your Apache server. It was a while ago when I got this working, so I'm sure if everything is needed in that config - once I get it working I tend to forget stuff :)

    Hope that helps, Chris.

提交回复
热议问题