0

I want to front Tomcat with Apache on a new Mac Server but Im missing some minor step. At the moment both servers are running, but port 8009 is not proxied correctly. 80 and 8080 is working.

I read that Mac/Apache has mod_proxy_ajp installed and should also be ready to run. (Mentioned by for example Vladimir How to install mod_jk on Mac OS X)

Can someone guide me step by step on a new server from scratch, since all guides on internet, and documentations has not lead to success. (Sorry for asking, but im stuck after 1 week of nightly trials(errors). Im really going nuts here. I would appreciate folderpaths too, since files sometimes are located on more than one location)

Thanks in advance!

Regards Niklas

Community
  • 1
  • 1
user3917688
  • 11
  • 1
  • 4
  • Found one error. I need to watchout for correct filepaths. I thought Apache was configured in /etc/apache2/httpd.conf. But when Server.app is installed this file is copied to /Library/Server/Web/Config/apache2/httpd_server_app.conf. Maybee this is one of the errors. Maybee this is the file to change? I will try. – user3917688 Aug 07 '14 at 10:14
  • Yes this was the case! – user3917688 Aug 07 '14 at 13:33

2 Answers2

1

Sorry for the delay, I was not allowed to answer my own question within 8 hrs (lack of points) but Yes I got it working! Mavericks Mac OSX server is really easy to setup and use with Apache as front to Tomcat. (If you know how to....)

Now I have tomcat integrated so that php with url: localhost is handeled by Apache and jsp url: localhost/examples -> runs tomcat but doesnt show the port, it looks integrated.

How I did it?

1) Uncomment if neccessary the line in server.xml for tomcat located in opt/apache-tomcat-8.0.9/conf:

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Restart the tomcat server

2) Edit the Apache config file located: /Library/Server/Web/Config/apache2/httpd_server_app.conf

This strange name and location is caused by Mac Server.app and was what caused most problems, since I did not realize they renamed and copied the httpd.conf file to a second location! I was all the time changing the wrong config file...

I added this text with a texteditor TextMate (The program can show hidden files, and ask for adminpass when changing the file)

The Default webpage in Mac.Server is located as below Document Root

<VirtualHost *:80> 
   ServerName localhost 
   DocumentRoot "/Library/Server/Web/Data/Sites/Default"

   <Proxy *> 
    AddDefaultCharset Off 
    Order deny,allow 
    Allow from localhost 
   </Proxy> 
   ProxyPass /examples ajp://localhost:8009/examples/ 
   ProxyPassReverse /examples ajp://localhost:8009/examples/ 
</VirtualHost>
user3917688
  • 11
  • 1
  • 4
0

Please ensure your mod_proxy_ajp module is enable in Apache.

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

Once that is done put below code in your VirtualHost with relevant host details.

ProxyPreserveHost On
ProxyPass           /   ajp://localhost:8009/
ProxyPassReverse    /   ajp://localhost:8009/
KNOWARTH
  • 912
  • 7
  • 14