Apache + Tomcat + cygwin

Source: Internet
Author: User

Recently, an Apache + Tomcat environment needs to be created for some reasons. But the trouble is that you do not have a Linux machine on hand, but you do not want to use Windows or install Linux. Therefore, I chose a solution like Apache + Tomcat + cygwin. The following is my detailed installation and configuration process.

0 platform

Windows XP (SP2)

JDK 1.4.2

Cygwin

1. Preparations

1.1 install necessary packages on cygwin

Run the setup program of cygwin. In the Select Packages dialog box, select the following tool (click "Skip" before the package name ":

  1. Autoconf
  2. Automake

  3. Cygrunsrv

  4. Gcc-core

  5. Gcc-G ++

  6. Make

  7. Perl

  8. Python

Click "Next" to start installation.

 

1.2 download code

These projects have many versions, and not all versions are suitable for this solution. The options are as follows:

  1. Apache 2.2.2
  2. Tomcat 4.1.31
  3. JK Connector 1.2.15

Source code of Apache and JK connector is directly decompressed to home/username under cygwin installation directory.

2 compile/install

First, run cygwin. A Window similar to a command line will appear, which is used in the same way as a Linux character terminal. The following installation process is not described in the cygwin window. JK connector connects to Apache statically.

 

2.1 compile/install JK Connector

Before compiling, you must first compile Apache once. Otherwise, some files cannot be found. For Apache compilation, see 2.2.

CD/home/usrename/jakarta-tomcat-connectors-1.2.15-src

./Configure -- With-Apache =/home/username/httpd-2.2.2

Make

Make install

 

2.2 compile/install Apache

Httpd-2.2.2/CD/home/username/

./Buildconf

./Configure -- with-mod_jk

Make

Make install

 

2.3 install Tomcat

Decompress the Tomcat package to USR/local under the cygwin installation directory. For convenience, create a connection.

Ln-S/usr/local/jakarta-tomcat-4.1.31/usr/local/tomcat

3 Configuration

3.1 configure Apache

  1. Create worker. properties, you can directly use JK connector's sample: CP/home/usrename/jakarta-tomcat-connectors-1.2.15-src/JK/CONF/worker. properties/usr/local/apache2/Conf
  2. Create the JK connector log file directory: mkdir/var/log/httpd
  3. Modify/usr/local/apache2/CONF/httpd. conf to add configuration for JK Connector

# JK connector configurations
Jkworkersfile/usr/local/apache2/CONF/workers. Properties
# Where to put JK logs
Jklogfile/var/log/httpd/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"
# Send servlet for context/examples to worker named ajp13
Jkmount/examples/servlet/* ajp13
# Send JSPs for context/examples to worker named ajp13
Jkmount/examples/*. jsp ajp13
Jkmount/examples * ajp13

3.2 configure cygwin

  1. Modify/home/username/. bashrc and add environment variables.

Path =/usr/local/apache2/bin:/usr/local/tomcat/bin :$ {path}
Export path

Tomcat_home =/usr/local/tomcat
Export tomcat_home

Catalina_home =/usr/local/tomcat
Export catalina_home

Apache2_home =/usr/local/apache2
Export apache2_home

  1. Install cygwin server in Windows Service; otherwise, Apache cannot be started in the background and run the command

Cygserver-config

In addition, cygwin is set to server in the Windows environment variable.

4. Start

4.1 start Tomcat

Run the script:

Startup. Sh

Enter http: // localhost: 8080 in the address bar of the browser. If the Tomcat page appears, Tomcat is successfully installed.

4.1 start Apache

Run the script:

Apachectl start

Enter http: // localhost in the address bar of the browser. If "It works!" appears! ", Indicating that Apache is successfully installed.

4.3 Test Tomcat access from Apache

Enter http: // localhost/examples in the address bar of the browser. If the Tomcat page appears, the entire installation is successful.

You can access http: // localhost/examples/servlet to test whether the servlet is normal.

How is it? Is it very simple? Now I have an Apache + Tomcat environment running in Linux!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.