I have never understood the integration of apache2.0.50 and tomcat5.0.27, so I switched to Apache + resin, which makes it easy to configure. During the configuration process, I recorded the operations and sorted them out.
Operating System Fedora Core 1
Software Download:
J2sdk1.4.2 j2sdk1.4.2 http://java.sun.com
Apache2.0.50 httpd-2.0.50.tar.gz http://apache.org
Resin.3.0.8 resin-3.0.8.tar.gz http://www.caucho.com
1. j2sdk Installation
To install j2sdk. 1.4.2.bin, follow these steps:
1). Modify file attributes: chmod 755 j2sdk. 1.4.2.bin
2). Run the file:./j2sdk. 1.4.2.bin
3) if an agreement is displayed, press enter to read the agreement until yes or no is displayed. Enter yes and agree to the agreement.
4) establish a connection: ln-S/usr/local/j2sdk. 1.4.2/usr/local/JDK
5). There are many ways to add environment variables. I used/etc/profile. d/to add or modify the file java. Sh:
# Set Java environment
Java_home =/usr/local/JDK
Path =.: $ path: $ java_home/bin
Classpath =.: $ classpath: $ java_home/lib
Export java_home path classpath
Note: The environment variable needs to restart the computer. You can temporarily use the command to assign the environment variable. The command is as follows:
Export java_home =/usr/local/JDK
Export Path =.: $ path: $ java_home/bin
Export classpath =.: $ classpath: $ java_home/lib
6). Test Environment
A. Enter Java and javac will be helpful.
B. Which Java
C. Recommended test file:
Public class hello
{
Public static void main (string [] ARGs)
{
System. Out. println ("hello, I love Java !");
}
}
Save the file as hello. Java and execute javac hello. Java and Java hello. Check whether it is running normally. Hello, I love Java! Indicates that the program runs normally.
Java is installed successfully!
Ii. install Resin
12.16.download resin-3.0.8.tar.gz
2). decompress: tar-zxvf resin-3.0.8.tar.gz/usr/local
3) establish a connection: ln-S/usr/local/resin-3.0.8/usr/local/resin
4 ). enter/usr/local/resin/bin and run. /httpd. sh start starts resin. If no error occurs, enter http: // ip: 8080 in the browser to view the result. If the resin page is displayed, the installation is successful.
3. install Apache
12.16.download httpd-2.0.50.tar.gz
2). decompress: tar-zxvf httpd-2.0.50.tar.gz/usr/local
3). Enter/usr/local/httpd-2.0.50 Directory: CD/usr/local/httpd-2.0.50
4). configuration information:
#./Configure-Prefix =/usr/local/apache2/
-- Enable-so-enable-SSL
Note:
A. You can use./configurer to view the help of this command.
B.-prefix to configure the installation path of Apache
C. -- enable-So make Apache support module (SO)
D.-enable-SSL enables Apache to support SSL.
5). Compile: Make
6) install: make install
7). Copy/usr/local/apache2/bin/apachectl to/etc/rc. d/init. d/httpd so that Apache can be started on its own. CP/usr/local/Apache/bin/apachectl/etc/rc. d/init. d/httpd
8). Enter the/etc/rc. d/rc3.d directory.
9). ln-S ../init. d/httpd s80httpd
Enable the system to automatically load Apache at startup.
10). Start the service: apachectl start
11). Test: Enter http: // 127.0.0.1/in the browser. If the Apache page appears, the Apche installation is successful.
Note: (some paths after installation are described)
A. the configuration file is under/etc/httpd/conf and/etc/httpd/CONF. D, serverroot/etc/httpd
B. Document location: under DocumentRoot/var/WWW, HTML is htm, HTML, and cgi-bin is where cgi files are stored.
C. The default file opened by Apache is/var/www/error1.
By default, the page configuration information is displayed in:/etc/httpd/CONF. d/welcome. conf. You can comment out the description pointing to error1.
D. If necessary, you can modify/etc/httpd/CONF/httpd. conf.
10). modify the configuration file:
A. supports Chinese adddefacharcharset gb2312
B. cgi and Perl supported:
Scriptallias/cgi-bin/"/var/www/cgi-bin /"
<Directory "/var/www/cgi-bin/">
AllowOverride none
Option none
Order allow, deny
Allow from all
</Directory>
Addhandler CGI-script. cgi. pl
Note: For programs under cgi-bin, You need to modify the file attribute to executable. cgi and. pl can be executed normally.
Iv. Integration of Apache and resin
1. Go to the resin installation directory: CD/usr/local/resin
2. Configure resin:
./Configure -- With-apxs =/usr/local/apache2/bin/apxs
3. Compile resin: Make
4. install Resin: make install
5. After the installation, mod_caucho.so in/usr/local/apache2/modules/mod_caucho.so
6. Modify/usr/local/resin/CONF/resin. conf.
<Document-directory>/var/www/html </document-directory>
7. Modify/etc/httpd/CONF/HTTP. conf and add the following content:
Loadmodule caucho_module/usr/local/apache2/modules/mod_caucho.so
<Ifmodule mod_caucho.c>
Resinconfigserver/usr/local/resin. conf
</Ifmodule>
8. Configure the environment variable:/etc/profile. d/resin. Sh
Resin_home =/usr/local/resin
Path = $ path: $ resin_home/bin
Export resin_home
8. Restart resin and Apache
Httpd. Sh stop
Apachectl stop
Httpd. Sh start
Apachectl start
Or
/Usr/local/resin/bin/httpd. Sh stop
/Usr/local/apache2/bin/apachectl stop
/Usr/local/resin/bin/httpd. Sh start
/Usr/local/apache2/bin/apachectl start
Note: environment variables need to be restarted. To be effective now, you need to manually set them using commands.
Export resin_home =/usr/local/resin
Export Path = $ patth: $ resin_home/bin
9. Create a test file:
Test. jsp (/var/www/html)
<% @ Page Language = "Java" %>
2 + 2 = <% = 2 + 2%>
10. test:
Http: // www.179ip.com/test.jsp
Http: // www.179ip.com: 8080/test. jsp
2 + 2 = 4, indicating that the installation is successful.
5. Set resin and Apache to self-start.
Add the following content under etc/rc. d/rc. Local:
Echo "Starting resing 3.0.8 ......"
Httpd. Sh start
Echo "Starting Apache 2.0.50 ......"
Apachectl start