I've got a Centos5 with running httpd, mysql and tomcat6. All fine. Let me attain the following
world wide web.domain.com >>> forwards/proxies to www.domain.com:8080/myapplication (offered by tomcat) www.domain.com/phpmyadmin >>> www.domain.com/phpmyadmin (offered by Apache from htdocs) www.domain.com/* >>> also serverd by htdocs folder as "normal" Apache content
How do i accomplish this? Any ideas?
Your only deviation from apache serving htdocs appears to become delivering stuff to tomcat, that is managing a servlet "myappplication". Within this situation,
- Define a staff (some text string, allows refer to it as "myworker").
- Close to the finish of file /etc/apache2/apache2.conf, add the lines
--Ignore this line within the publish--
# Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile /etc/apache2/workers.properties # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) JkLogFile /var/log/apache2/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" JkMount /myapplication/* myworker
For the reason that directory, produce a file "employees.qualities", that consists of the next:
worker.myworker.type=ajp13 worker.myworker.host=localhost worker.myworker.port=8081 worker.myworker.cachesize=10 worker.myworker.cache_timeout=600 worker.myworker.socket_keepalive=1 worker.myworker.socket_timeout=300
Edit the road tomcat_inst_dir/conf/server.xml to set up a line
[Connector port="8081" protocol="AJP/1.3" /]
Note: alter the square brackets to position brackets. The above mentioned line goes within the [service]...[/Service] tags and from the [Engine] ... [/Engine] tags, place it right over the [Engine] line.
- Restart apache and tomcat
Now any request to "http://www.domain.com/myapplication/servletName[?componen=value...]" will get rerouted by apache (on port 80) to tomcat (on port 8081) and onto the servlet myapplication. I suppose you've got a directory "tomcat_home/webapps/myapplication", which includes a directory WEB-INF having a "web.xml" file inside it. "servletName" above is exactly what you define between your [servlet-title]...[/servlet-title] tags for the reason that file.
I selected the amount 8081 (you can choose your port number as lengthy because it does not conflict along with other standard services) to ensure that port 8080 continues to be active that you should test "http://www.domain.com:8080/myapplication/servletName" (should produce same output on ports 8080 and 80, the apache port).
IMPORTANT: Have a backup copy of all of the files transformed within the above process, so that you can revert to your working system when the above does not work. I needed to undergo numerous iterations of the aforementioned to have it working!
Best of luck, and hope this calculates for you personally, - M.S.
PS. Sorry concerning the formatting - I couldnt understand this much better
Have your index file in www.domain.com redirect to www.domain.com:8080/myapplication. Example index.php:
<?php header("Location: http://www.domain.com:8080/myapplication"); ?>
Not the cleanest or most elegant way however it works. The elegant approach is always to use vhosts in apache.