安装和配置Apache2和Tomcat6 [Linux Debian]
1、安装apache2,tomcat6
apt-get install apache2 tomcat6 libapache2-mod-jk
2、配置jk模块
cd /etc/apache2/mods-available
vim jk.conf
JkWorkersFile /etc/libapache2-mod-jk/workers.properties
JkLogFile /usr/local/apache2/logs/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"
3、启用jk模块
a2enmod jk
Enabling config file jk.conf.
Run '/etc/init.d/apache2 restart' to activate new configuration!
4、配置ports文件
cat /etc/apache2/ports.conf
8 NameVirtualHost *:80
9 Listen 80
5、添加和配置站点
vim /etc/apache2/sites-available/wnes.cn
<VirtualHost *:80>
ServerName wnes.cn
ServerAdmin test@test.com
DocumentRoot /home/luosiyong/www/ROOT
ErrorLog "/var/log/apache2/wnes.cn.error"
CustomLog "/var/log/apache2/wnes.cn.log" common
JkMount /* ajp13_worker
</VirtualHost>
vim /etc/apache2/sites-available/a.wnes.cn
<VirtualHost *:80>
ServerName a.wnes.cn
ServerAdmin test@test.com
DocumentRoot /home/mazip/www/ROOT
ErrorLog "/var/log/apache2/a.wnes.cn.error"
CustomLog "/var/log/apache2/a.wnes.cn.log" common
</VirtualHost>
6、启用站点
a2ensite wnes.cn
a2ensite a.wnes.cn
7、tomcat模块启用AJP连接协议
vim /etc/tomcat6/server.xml
92 <!-- Define an AJP 1.3 Connector on port 8009 -->
93 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
备注:
如果出现解析主机的错误,可以在httpd.conf中指定:
ServerName localhost
评论