Apache+Php+tomcat+mysql整合手册
Apache+Php+tomcat+mysql整合手册
一. 需要的安装包
httpd-2.0.52.tar.gz
jakarta-tomcat-5.0.28.tar.gz
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
Php_439RC3.tar.gz
mysql-4.0.21.tar.gz
二. apache的安装
./configure
--prefix=/usr/local/apache
--enable-so
make
make install
*enable-so的意思是允许动态加载库
三. mysql的安装
./configure
--prefix=/home/mysql
--with-mysqld-user=beinan
--with-charset=gb2312
--with-extra-charsets=all
--with-unix-socket-path=/home/mysql/var/mysql.sock
make
make install
四. Php的安装
Php一定要在apache和mysql安装后安装
./configure
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/home/mysql
--enable-sockets
make
make install
安装结束后 cp Php.ini-dist /usr/local/lib/Php.ini
现在修改apache的配置文件httpd.conf,加入对Php的支持
LoadModule Php5_module modules/libPhp5.so
AddType application/x-httpd-Php .Php .phtml
AddType application/x-httpd-Php-source .Phps
DirectoryIndex index.html index.html.var index.jsp index.Php
重新启动apache进程
五. tomcat的安装
直接将tomcat的安装包解压到安装目录/home/tomcat,设置环境变量Java_HOME即可正常启动tomcat
六. tomcat和apache的整合
安装jk2模块以使apache和tomcat之间可以通信,使用的jk2模块包是jakarta-tomcat-connectors-jk2-2.0.4-src
./configure --with-apxs=/usr/local/apache/bin/apxs --enable-EAPI
make
make install
安装结束后,在apache /modules下面会有mod_jk2.so文件,现在修改apache的配置文件httpd.conf加入一条
LoadModule jk2_module modules/mod_jk2.so
在apache/conf目录下面创建workers2.properties文件,配置交给tomcat处理的uri路径
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
[uri:/*.jsp]
worker=ajp13:localhost:8009
[uri:/servlet/*]
worker=ajp13:localhost:8009
[uri:/servlets-examples/*]
worker=ajp13:localhost:8009
[uri:/game/*]
worker=ajp13:localhost:8009
至次, Apache+Php+tomcat+mysql的整合全部完成
Apache+Php+tomcat+mysql整合手册
一. 需要的安装包
httpd-2.0.52.tar.gz
jakarta-tomcat-5.0.28.tar.gz
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
Php_439RC3.tar.gz
mysql-4.0.21.tar.gz
二. apache的安装
./configure
--prefix=/usr/local/apache
--enable-so
make
make install
*enable-so的意思是允许动态加载库
三. mysql的安装
./configure
--prefix=/home/mysql
--with-mysqld-user=beinan
--with-charset=gb2312
--with-extra-charsets=all
--with-unix-socket-path=/home/mysql/var/mysql.sock
make
make install
四. Php的安装
Php一定要在apache和mysql安装后安装
./configure
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/home/mysql
--enable-sockets
make
make install
安装结束后 cp Php.ini-dist /usr/local/lib/Php.ini
现在修改apache的配置文件httpd.conf,加入对Php的支持
LoadModule Php5_module modules/libPhp5.so
AddType application/x-httpd-Php .Php .phtml
AddType application/x-httpd-Php-source .Phps
DirectoryIndex index.html index.html.var index.jsp index.Php
重新启动apache进程
五. tomcat的安装
直接将tomcat的安装包解压到安装目录/home/tomcat,设置环境变量Java_HOME即可正常启动tomcat
六. tomcat和apache的整合
安装jk2模块以使apache和tomcat之间可以通信,使用的jk2模块包是jakarta-tomcat-connectors-jk2-2.0.4-src
./configure --with-apxs=/usr/local/apache/bin/apxs --enable-EAPI
make
make install
安装结束后,在apache /modules下面会有mod_jk2.so文件,现在修改apache的配置文件httpd.conf加入一条
LoadModule jk2_module modules/mod_jk2.so
在apache/conf目录下面创建workers2.properties文件,配置交给tomcat处理的uri路径
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
[uri:/*.jsp]
worker=ajp13:localhost:8009
[uri:/servlet/*]
worker=ajp13:localhost:8009
[uri:/servlets-examples/*]
worker=ajp13:localhost:8009
[uri:/game/*]
worker=ajp13:localhost:8009
至次, Apache+Php+tomcat+mysql的整合全部完成