摘要
Apache httpd-2.0.47 + Tomcat jakarta-tomcat-4.1.24 + jk2 + php-4.3.3 的安装(2003-11-14 21:13:53)
--------------------------------------------------------------------------------
By iHero
Apache httpd-2.0.47 + Tomcat jakarta-tomcat-4.1.24 + jk2 + php-4.3.3 的安装:
服务器环境:
RedHat Linux 8.0
J2sdk1.4.1_02
Tomcat 4.1.12 binary
Apache 2.0.47 built from source
jk2 connector source from jakarta.apache.org
安装JDK:
下载: j2sdk-1_4_1_02-linux-i586.bin
把jdk 安装在/usr/local/j2sdk1.4.1_02
在/usr/local 下建立 软连接 jdk
#ln -s /usr/local/j2sdk1.4.1_02 /usr/local/jdk
[user@host]# cat /etc/profile.d/java.sh
# set java environment
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
#更改shell文件属性:
#chmod 755 /etc/profile.d/java.sh
#查看是否正确
#which java
/usr/local/jdk/bin/java
安装apache :
#cd /usr/local/src/
#tar -xzvf httpd-2.0.47.tar.gz
#cd httpd-2.0.47
#配置apache 支持动态module 加载
#./configure
"--with-layout=Apache"
"--prefix=/usr/local/apache"
"--enable-module=so"
"--enable-module=setenvif"
"--enable-module=rewrite"
"--with-mpm=prefork"
#make
#make install
#修改http.conf 具体的修改请参考apache2.0文档
# 或者查看 http://www.cnfug.org/journal/3/02.html
StartServers 10
MinSpareServers 25
MaxSpareServers 50
ServerLimit 2000
MaxClients 1500 #Apache可以同时处理的请求
MaxRequestsPerChild 10000
安装Php :
下载: php-4.3.3.tar.gz
#cd /usr/local/src
#tar -xzvf
#php for apache 以apache modules的方式运行
./configure --with-apxs2=/usr/local/apache/bin/apxs
#php run like shell 以单独的shell方式运行
./configure --prefix=/usr/local/php
#php for apache
./configure
--with-apxs2=/usr/local/apache/bin/apxs
--enable-track-vars
--enable-debug
--enable-url-includes
--enable-sockets
--with-config-file-path=/usr/local/apache/conf #php.ini文件放的目录
#下面的参数是安装PHP + gd库
--with-gd=/usr/local
--enable-gd-native-ttf
--with-ttf=/usr/local
--with-jpeg-dir=/usr/local
--with-zlib-dir=/usr/local
--with-png-dir=/usr/local
#make
#make install
#ls -l /usr/local/apache/modules/libphp4.so #存在 安装成功
#修改apache http.conf
添加
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php
安装Tomcat:
#cd /usr/local
#tar -xzvf jakarta-tomcat-4.1.24.tar.gz
#ln -s jakarta-tomcat-4.1.24 tomcat
#测试Tomcat正常安装:
#/usr/local/tomcat/bin/startup.sh
#通过IE http://yourIP:8080/ Tomcat的页面正常显示
安装JK2 :
#cd /usr/local/src
#tar -xzvf jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz
#cd jakarta-tomcat-connectors-jk2-2.0.2-src
#cd jk/native2
#chmod 755 buildconf.sh
#./configure --with-apxs2=/usr/local/apache/bin/apxs --enable-EAPI
#make
#make install
#如果make install 不成功需要手工发布mod_jk2.so
#cd /usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/build/jk2/apache2
#cp *.so /usr/local/apache/modules/
配置$CATLINA/conf/server.xml
debug="0"/>
debug="0"/>
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="-1"
useURIValidationHack="false" disableUploadTimeout="true" />
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="-1"
useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
prefix="catalina_log." suffix=".txt"
timestamp="true"/>
unpackWARs="true" autoDeploy="true">
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
#编辑
#vi /usr/local/tomcat/conf/jk2.properties
# list of needed handlers.
handler.list=channelSocket,request
# Override the default port for the channelSocket
channelSocket.port=8009
#编辑文件:
#vi /usr/local/apache/conf/workers2.properties
# only at beginnin. In production uncomment it out
[logger.apache2]
level=DEBUG
[shm]
file=/usr/local/apache/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:192.168.0.90/*.jsp]
worker=ajp13:localhost:8009
[uri:211.167.83.165/*.jsp]
worker=ajp13:localhost:8009
#编辑http.conf
#修改
DocumentRoot "/usr/local/tomcat/webapps"
#添加index.jsp
DirectoryIndex index.html index.html.var index.jsp
LoadModule jk2_module modules/mod_jk2.so
Order deny,allow
Deny from all
#
# Order deny,allow
# Deny from all
#
Order Allow,Deny
ServerName www.home.net
ServerAlias www
ServerAlias localhost
ServerAlias 192.168.0.90
ServerAlias 211.167.83.165
ServerAdmin webmater@5757.com
DocumentRoot /usr/local/tomcat/webapps
ErrorLog logs/home.net-errorlog
CustomLog logs/home.net-access.log common
JkUriSet worker ajp13:localhost:8009
在配置server.xml 的时候:
配置管理端口 和连接的端口顺序颠倒一下
在 catalina.out 可以观察到:
这样用apache 连接的时候,就不用等待了.
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="0"
useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
#server.xml 不支持中文的注释
#对 shared/classes 目录下的java进行的修改不能立刻的反应到jsp中标.不能立即起作用.
以上的安装同样适合jakarta-tomcat-5.0.12 在以下的配置中注意
#在配置 jakarta-tomcat-5.0.12 的时候,注意 server.xml 中
没有封闭.
BUG:
在catalina.out 报错误.
总体上感觉tomcat 5.0 比4.x在性能上是有了改进.启动的速度快.
dzho002 回复于:2003-12-23 07:58:02 |
我的DocumentRoot 是这样的:
DocumentRoot "/usr/local/tomcat/webapps/jsp-examples" 当我用 http://localhost/index.html, 我可以看到JSP例子的那页, 但我点一个JSP程序, TOMCAT 报错, 找不到文件. 当我用 http://localhost/index.jsp, 我可以看到JSP例子的那页, 但是看不到网页上的图标. 连过去的JSP程序到是可以运行. 这是为啥? |
jhsea3do 回复于:2003-12-23 09:40:24 |
5.0是个不成熟的产品,当你使用5.0代替4.1时你会发现很多webapp不能正常工作,因为5.0不支持JSP1.2,而支持JSP2.0 |
dzho002 回复于:2003-12-24 05:24:06 |
[b:8a23c5158b]Tomcat 5.0.6 + jk2 + Apache 2.0[/b:8a23c5158b]
dzho002 [b:8a23c5158b]Install tomcat[/b:8a23c5158b] [code:1:8a23c5158b]cp jakarta-tomcat-5.0.16.tar.gz /usr/local cd /usr/local tar xzvf jakarta-tomcat-5.0.16.tar.gz ln -s jakarta-tomcat-5.0.16 tomcat rm -f jakarta-tomcat-5.0.16.tar.gz [/code:1:8a23c5158b] Add following lines to /etc/profile, and tomcat should work beyond this point. [code:1:8a23c5158b]export PATH=/usr/local/j2sdk1.4.2_01/bin:$PATH export JAVA_HOME=/usr/local/j2sdk1.4.2_01 export CATALINA_HOME=/usr/local/tomcat [/code:1:8a23c5158b] [b:8a23c5158b]Test Tomcat[/b:8a23c5158b] [code:1:8a23c5158b]source /etc/profile /usr/local/tomcat/bin/startup.sh It is time to open the page http://localhost:8080/ in mozilla to watch the cat(tiger). /usr/local/tomcat/bin/shutdown.sh [/code:1:8a23c5158b] [b:8a23c5158b]Install Apache 2[/b:8a23c5158b] [code:1:8a23c5158b] tar xzvf httpd-2.0.48.tar.gz cd httpd-2.0.48 ./configure --prefix=/usr/local/apache --enable-ssl --enable-so make make install [/code:1:8a23c5158b] [b:8a23c5158b]Test apache2[/b:8a23c5158b] [code:1:8a23c5158b]/usr/local/apache/bin/apachectl start [/code:1:8a23c5158b] There is a complaint: "httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName" Donot know why yet. Now, open the page http://localhost/ to see the Apache main page from Mozilla. [code:1:8a23c5158b]/usr/local/apache/bin/apachectl stop[/code:1:8a23c5158b] [b:8a23c5158b]Install jk2[/b:8a23c5158b] [code:1:8a23c5158b] tar xzvf jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz cd jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2 ./configure --with-apxs2=/usr/local/apache/bin/apxs make ls ../build/jk2/apache2/*.so ../build/jk2/apache2/jkjni.so ../build/jk2/apache2/mod_jk2.so cp ../build/jk2/apache2/*.so /usr/local/apache/modules/ [/code:1:8a23c5158b] [b:8a23c5158b]Edit /usr/local/apache/conf/httpd.conf[/b:8a23c5158b] Add a line to load the jk2 module. [code:1:8a23c5158b]LoadModule jk2_module modules/mod_jk2.so [/code:1:8a23c5158b] [b:8a23c5158b]Edit /usr/local/tomcat/conf/jk2.properties[/b:8a23c5158b] It finnally looks like: (jk2 connector over TCP socket.) [code:1:8a23c5158b][shm] shm.file=/usr/local/tomcat/logs/jk2.shm size=1048576 handler.list=apr,request,channelSocket channelSocket.port=8009 [/code:1:8a23c5158b] Edit /usr/local/apache/conf/workers2.properties If it is not there, just create one by: [code:1:8a23c5158b] touch /usr/local/apache/conf/workers2.properties [/code:1:8a23c5158b] [code:1:8a23c5158b] [shm] shm.file=/usr/local/tomcat/logs/jk2.shm size=1048576 [channel.socket:localhost:8009] tomcatId=localhost:8009 [ajp13:localhost:8009] channel=channel.socket:localhost:8009 worker=ajp13:localhost:8009 [uri:/jsp-examples/*] [uri:/servlets-examples/*] [uri:/JSPWiki/*] [/code:1:8a23c5158b] Edit /usr/local/tomcat/conf/server.xml Just find and comment out the following HTTP/1.1 connector. Looks like it still works fine even if I donot do it. [code:1:8a23c5158b] <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 --> <!-- <Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" /> --> [/code:1:8a23c5158b] Now it is time to test apache + tomcat http://localhost/ ---> open the default page of apache. http://localhost/servlets-examples/ ---> open the servlets-examples page of tomcat. http://localhost/jsp-examples/ ---> open the servlets-examples page of tomcat. Done! Some optional steps: A puzzle: If I use this uri in the workers2.properties, [uri:/*.jsp] worker=ajp13:localhost:8009 http://localhost/ ---> open the default page of apache. http://localhost/index.jsp ---> open the main page of tomcat, but all images are missing. This is what I want if somebody can find those images back for me. Modify /usr/local/tomcat/conf/tomcat-users.xml Add two roles and a user with those roles, so dan can admin/manage tomcat via web. <role rolename="manager"/> <role rolename="admin"/> <user username="dan" password="tomcat" roles="manager,admin,tomcat,role1"/> Start tomcat and try these two pages. http://localhost:8080/admin/ http://localhost:8080/manager/html/ The first page looks very complicated, while the second one allows you to start/stop any JSP program in Tomcat easily. [b:8a23c5158b]To Run tomcat as a no-root user[/b:8a23c5158b] [code:1:8a23c5158b]groupadd tomcat useradd -g tomcat -c "A Big Cat", -d /usr/local/tomcat tomcat passwd tomcat chown tomcat:tomcat /usr/local/tomcat chown -R tomcat:tomcat /usr/local/jakarta-tomcat-5.0.16 su - tomcat -c /usr/local/tomcat/bin/startup.sh su - tomcat -c /usr/local/tomcat/bin/shutdown.sh [/code:1:8a23c5158b] References [url]http://www.greenfieldresearch.ca/technical/jk2_config.html[/url] [url]http://johnturner.com/howto.apache2-tomcat4127-jk-rh9-howto.html[/url] |
黑色 回复于:2004-01-12 13:26:33 |
請教一下,我照著上面所述,做到make的時侯
出現 libtool: install: warning: remember to run `libtool --finish /usr/local/httpd/m dules' make[1]: Leaving directory `/misc/tomcat4/jakarta-tomcat-connectors-jk2-2.0.2-s c/jk/native2/server/apache2' 然後去看 build/jk2/apache2 裡面只有一堆.o跟.lo沒有.so >_< 請問各位高手,我是少了什麼步驟沒做嗎?? |
dennis2 回复于:2004-01-12 17:02:49 |
[quote:ca142f9261="jhsea3do"]5.0是个不成熟的产品,当你使用5.0代替4.1时你会发现很多webapp不能正常工作,因为5.0不支持JSP1.2,而支持JSP2.0[/quote:ca142f9261]
“因为5.0不支持JSP1.2,而支持JSP2.0” 所以得出结论 “5.0是个不成熟的产品”? 什么逻辑 |
jhsea3do 回复于:2004-01-12 22:37:06 |
[quote:ea599ead34="dennis2"]
“因为5.0不支持JSP1.2,而支持JSP2.0” 所以得出结论 “5.0是个不成熟的产品”? 什么逻辑[/quote:ea599ead34] 请问你有没有亲手编写过jsp,如果没有就不要说这样的话 :em22: ! 5.0不仅仅是对jsp得支持和4.1存在分歧,而且对servlet的支持也和4.1有出入,而且servlet一般都是被封装的class,你无法修改! |
dennis2 回复于:2004-01-13 01:16:07 |
[quote:173b9bc48b="jhsea3do"]
5.0不仅仅是对jsp得支持和4.1存在分歧,而且对servlet的支持也和4.1有出入,而且servlet一般都是被封装的class,你无法修改![/quote:173b9bc48b] 你只能说 5.0 对以前版本的应用不支持(或支持得不够好),而不是不成熟。Tomcat 5 很早就已经稳定下来了,只不过一直在等着新的标准出来,它才出正式的稳定版。而这个新标准的出台,也是酝酿了很久很久了。 如果把给 4.1 版本写的应用原封不动地搬到 5.0 使用,无异于自找麻烦。但是新的应用就没必要再针对 4.1 版写了,因为 JSP 2.0 相对 1.2 有了很大改进。当然具体情况具体分析,但你却不能说 5.0 版不成熟。 |
linuxsky 回复于:2004-02-16 14:47:43 |
我在一台机上也发现apache2目录下没有一个.so的文件
但以前在Redhat9 下面就可以 出的错也和黑色网友的一样 |
dennis2 回复于:2004-02-16 14:57:01 |
编译出的模块 .so 文件在 .libs 目录下。 |
linuxsky 回复于:2004-02-16 16:02:04 |
[quote:8f117d4dc1="dennis2"]编译出的模块 .so 文件在 .libs 目录下。[/quote:8f117d4dc1]
没有啊。我刚又试了一把 还是没看到 .libs目录下也没有.so的文件 |
dennis2 回复于:2004-02-17 09:38:05 |
如果你编译 jk2 没问题的话,.so 文件应该在 jakarta-tomcat-connectors-jk2-2.0.2-src/jk/build/jk2/apache2 下。 |
linuxsky 回复于:2004-02-17 10:58:33 |
是没有的。我以前编成功过
那是在Redhat9.0环境下 最近换成了AS3.0 就成功不了 连试几台机都一样。真是惨。 不过我用以前9.0下编好的so文件拷过去,还是可以用。就不知道会不会有其它问题 另外:我想问一下,如果我在httpd.conf里指定DocumentRoot /www 我希望这个目录下可以执行php 还有jsp html 等.. 我还需要在server.xml里怎么设置?或其它地方设置? |
只爱一点点 回复于:2004-02-17 14:01:10 |
好像不会有问题,只要和apache版本对应就行了吧? |
云海天涯 回复于:2004-02-17 15:45:48 |
good ,thank you |
kevinkan 回复于:2004-02-23 10:42:43 |
我整合 apach+tomcat的时候,在最好加上以下的语句
WebAppConnection warpConnection warp localhost:8080 WebAppDeploy examples warpConnection /examples/ 在重启的时候就出现了 Invalid virtual host name 究竟在那里解决这个问题? |
只爱一点点 回复于:2004-02-23 23:31:50 |
楼上用什么整合的?
JK2是不用上面的方面的吧? |
kpflysky 回复于:2004-02-24 17:51:18 |
谁有没有单独安装tomcat5.0的经验
我的servlet怎么不能部署上去 总提示servlet/*不存在 在4.0没有问题的 是标准的servlet |
caojiqun 回复于:2004-02-24 22:37:55 |
也许你要做一下servlet映射或是修改全局的server.xml |
jessicar 回复于:2004-03-24 19:07:17 |
拜托了!!!!!!!!! |
hfh08 回复于:2005-06-04 12:02:55 |
怎么安装上数据库啊
没有数据库 我认为这些都白做了啊 |
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/