将Apache和Tomcat集成到了一块
最后想了以下,我准备将php也集合到里面,以提供jsp和php服务
我想这也是一个不错的网站服务组合,希望能够帮到网友们
1》下载需要的软件:
Apache :      apache_2.0.55-win32-x86-no_ssl.msi    http://httpd.apache.org/
Tomcat :      apache-tomcat-5.5.23.exe       http://tomcat.apache.org/
Php      :       php-5.1.2-Win32.zip              http://www.php.net
Mysql :       mysql-5.0.19-win32.zip          http://www.mysql.org
PhpMyAdmin : phpMyAdmin-2.8              http://www.phpmyadmin.org
JDK    :jdk-6-windows-i586.exe          http://java.sun.com
JK插件:mod_jk-apache-2.0.59.so    http://tomcat.apache.org/download-connectors.cgi

2》安装软件
<1>安装Apache
在安装的过程中将会出现叫你填服务器的地址
我是这样写的:
127.0.0.1 或者localhost 或者是真实的ip地址或域名
127.0.0.1
your@126.com 也就是你的油箱
我的Apache的安装目录是:D:\php\Apache2
<2>安装JDK环境
我的JDK的安装目录是:C:\java\jdk1.6.0
并增加JAVA_HOME和PATH变量
分别是:JAVA_HOME=C:\java\jdk1.6.0
PATH=%JAVA_HOME%\bin
<3>安装Tomcat
Tomcat我采用的是默认安装
安装目录是:D:\php\Tomcat 5.5
<4>安装Mysql数据库
我的安装密码是:root
默认数据库编码是:utf-8
安装的目录是:D:\php\Tomcat 5.5
<5>安装php
我的php的安装目录是:D:\php\php

3》配置服务器,使能够提供jsp,php服务
<1>配置php
将php安装目录下的php.ini-dist文件改名为php.ini
php.ini文件中主要修改 Extensions
如果你需要修改其它的php配置,可以参考http;//php.net上的配置说明
修改办法:将扩展加入文件当中
并将:
extension=php_mbstring.dll
extension=php_dbase.dll
extension=php_gd2.dll
extension=php_mysql.dll
这些扩展前面的分号去掉
我做的修改是:
extension_dir = "d:/php/php/ext/"
extension=php_mbstring.dll
extension=php_dbase.dll
extension=php_gd2.dll
extension=php_mysql.dll
修改后的样子是这样的:
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
extension_dir = "d:/php/php/ext/"
extension=php_mbstring.dll
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_dba.dll
extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
extension=php_mysql.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
修改好php.ini文件后:将php.ini和libmysql.dll文件拷贝到C:\WINDOWS目录下

<2>配置Apache
将JK插件拷贝到D:\php\Apache2\modules目录中,它的作用是将jsp请求转发给Tomcat
修改http.conf 文件在D:\php\Apache2\conf目录中
web服务的目录我放到D:\php\webroot这个目录
主要修改:
1:修改DocumentRoot
改后的值:DocumentRoot "D:/php/webroot"
2:修改Directory
改后的值:
3:增加php服务功能
在ScriptAlias下面加上:
ScriptAlias             /cgi-bin/ "D:/php/Apache2/cgi-bin/"
ScriptAlias            /php/ "d:/php/php/"
addtype           application/x-httpd-php .php
action          application/x-httpd-php "/php/php.exe"
修改后的样子是这样的
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "D:/php/Apache2/cgi-bin/"
ScriptAlias /php/ "d:/php/php/"
addtype application/x-httpd-php .php
action application/x-httpd-php "/php/php.exe"

4:加载模块
在Dynamic Shared Object (DSO) Support下面加入:
LoadModule php5_module "d:/php/php/php5apache2.dll"
LoadModule jk_module modules/mod_jk-apache-2.0.59.so
加载的模块分别是php模块和jk模块

5:增加tomcat转发配置
在文件结尾加入:
JkWorkersFile "D:\php\ConnApaTom\workers.properties"
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
JkMount /*.do ajp13

保存http.conf文件即可

6:配置和Tomcat的集成
新建ConnApaTom目录:目录地址是:
D:\php\ConnApaTom
将写好的workers.properties文件保存到该目录中
文件内容是:
workers.tomcat_home=D:\php\Tomcat 5.5
workers.java_home=C:\java\jdk1.6.0
worker.list=ajp12, ajp13
worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=ajp12, ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
worker.inprocess.cmd_line=start
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr

修改Tomcat的配置文件:server.xml
将服务目录该成:D:\php\webroot
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

保存即可

6:安装phpmyadmin
将phpmyadmin放到D:\php\webroot
并改名为admin
修改该目录下的:libraries目录中的config.default.php文件
将$cfg['Servers'][$i]['password']      = '';改为:
$cfg['Servers'][$i]['password']      = 'root';
改后的样子是这样的:
$cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user']          = 'root';      // MySQL user
$cfg['Servers'][$i]['password']      = 'root';
4》重启服务器
重启Apache和Tomcat

按以上说明配置,就可以了
所有的应用都可以放到D:\php\webroot目录
浏览以下就行了
这是我这几天配置的总结
希望能对网友们有所帮助
有什么问题的话
可以给我留言
当然还请你多指教!