Tomcat 4.1.18 + Apache 2.0.43 + SSL
I'm going to test out my articles on Tomcat+Apache and Apache+SSL this morning - and will update my findings here. I already have Tomcat 4.1.18 installed and working great. I will NOT be setting up clustered instances of tomcat (i.e. tomcat 1, tomcat2) but I will set up my environment to allow for a clustered environment. I am doing this on a Windows 2000 SP3 machine, which Cygwin installed. Cygwin has all the required modules already installed - SSH, OpenSSL, etc. Below are the errors I've found - hopefully someday I'll use this post to update the articles.
- The link to download the latest Linux version is bad. Update your bookmarks for the latest 2.0.43 release.
- Since I want SSL, I downloaded 2.0.43 with mod_ssl and OpenSSL 0.9.6 from http://hunter.campbus.com/.
- I unzipped the download to c:\Tools\apache and chose to "user folder names."
- I downloaded mod_jk-2.0.42.dll and put it in $APACHE_HOME\modules ($APACHE_HOME = c:\Tools\apache).
- Added the following to $APACHE_HOME\conf\http.conf after the last LoadModule:
#
# Load mod_jk
#
LoadModule jk_module modules/mod_jk-2.0.42.dll
#
# Configure mod_jk
#
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
- Below DocumentRoot in httpd.conf, I added:
JkMount /* tomcat1
... because I want everything to go to Tomcat. - Then I continued with Steps 2.3+, only configuring Tomcat1 though.
- NOTE: Checkout Step 6 for setting up multiple instances of Tomcat that can be used to host separate applications. For instance, this is great for setting up myapp1.raibledesigns.com, myapp2.raibledesigns.com. This is what I've always used Apache+Tomcat for, rather than for load balancing.
- Next I searched for @@ in http.conf and changed appropriately (all I change was the ServerAdmin. I also had to change line 57 from c:/apache to c:/tools/apache, and DocumentRoot from c:/apache/htdocs to c:/tools/apache/htdocs. 25 lines below DocumentRoot, change Directory to be the same as DocumentRoot.
- Navigate to $APACHE_HOME\bin and type "Apache -k install".
- Type "Apache -k start" and goto http://localhost. Hey it worked - first try!! There's an ApacheMonitor.exe file in $APACHE_HOME\bin that will allow to to start/stop/restart Apache from the SystemTray. Now onto configuring SSL.
- From step 3, creating a certificate, I literally copied and pasted all the command into Cygwin and everything worked without a hitch.
- I then uncommented the following line in httpd.conf: LoadModule ssl_module modules/mod_ssl.so
- I had to change all references from "c:/apache" to "c:/tools/apache" in the already installed ssl.conf file in the same directory as httpd.conf. I did this in httpd.conf just for kicks too - 11 replacements on top of those I already made.
- Then I commented out the <IfDefine SSL> tags at the beginning and the end of ssl.conf, since I want SSL to always be running.
- I then got the following error:
Syntax error on line 114 of C:/Tools/apache/conf/ssl.conf:
SSLCertificateFile: file 'C:/Tools/apache/conf/ssl.crt/server.crt' does not exist or is empty
So I changedSSLCertificateFile c:/tools/apache/conf/ssl.crt/server.crt
in ssl.conf to be (same as beginning of above)/conf/ssl/server.crt
, andSSLCertificateKeyFile c:/tools/apache/conf/ssl.key/server.key
to remove .key so it's just.../conf/ssl/server.key
. Then I stopped and restarted Apache. - Whalla!! - https://localhost/index.jsp worked like a charm.
Hope this helps make your next Tomcat/Apache installation easier.