windows2008 apache2.4 tomcat-7多域名绑定环境配置
Posted 曙光城邦
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了windows2008 apache2.4 tomcat-7多域名绑定环境配置相关的知识,希望对你有一定的参考价值。
=====================软件清单
Apache2.4.33
apache-tomcat-7.0.85
=====================
1.安装apache
1.1下载apache http://httpd.apache.org/download.cgi
1.2 下载Visual C++ 2015 x86 ,apache的基础环境 https://www.microsoft.com/en-us/download/details.aspx?id=49984
1.3 cmd执行httpd.exe -k install安装apache服务
2.安装jre
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
3.安装tomcat 7.0.85
http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.85/bin/apache-tomcat-7.0.85.exe
--------------------------
4.下载apache tomcat连接器mod_jk
https://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/
4.1拷贝mod_jk.so至modules目录中
4.2修改apache httpd.conf
修改域名
ServerName javaidea.cn:80
修改默认目录
DocumentRoot "D:/tomcat7/webapps/ROOT"
<Directory "D:/tomcat7/webapps/ROOT">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
开启虚拟主机配置
找到#Include conf/extra/httpd-vhosts.conf这句,将之前的#号去掉,开启虚拟主机配置。
最后增加
#apache+tomcat config start
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkMount /* worker1
JKUnmount /*.htm worker1
JKUnmount /*.html worker1
JKUnmount /*.css worker1
JkUnMount /*.gif worker1
JkUnMount /*.swf worker1
JkUnMount /*.bmp worker1
JkUnMount /*.png worker1
JkUnMount /*.jpg worker1
JkUnMount /*.js worker1
设置为除静态资源 全都转发给tomcat处理
4.3增加workers.properties
Apache2.4\conf下新建文件workers.properties并添加内容如下
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
4.4 apache虚拟主机配置
Apache24\conf\extra的httpd-vhosts.conf
<VirtualHost _default_:80>
DocumentRoot "D:/tomcat7/webapps/ROOT"
#ServerName www.example.com:80
ServerAlias www.javaidea.cn
JkMountCopy On
</VirtualHost>
# Add any other Virtual Hosts below
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "D:/tomcat7/jzy123/ROOT"
ServerName jzy123.com
ServerAlias www.jzy123.com
ErrorLog "logs/jzy123-error.log"
CustomLog "logs/jzy123.log" common
JkMountCopy On
<Directory "D:/tomcat7/jzy123/ROOT">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
5.tomcat多域名邦定
修改server.xml
<Host name="javaidea.cn" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Alias>www.javaidea.cn</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="javaidea_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
注: Options Indexes FollowSymLinks改为Options FollowSymLinks 禁用列出目录
注: (可选)Apache配置虚拟目录,httpd.conf中添加
Alias /qrcodes "d:/Qrcodes"
<Directory "d:/Qrcodes">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /images "d:/WebImages"
<Directory "d:/WebImages">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /apks "d:/Apks"
<Directory "d:/Apks">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
以上是关于windows2008 apache2.4 tomcat-7多域名绑定环境配置的主要内容,如果未能解决你的问题,请参考以下文章
windows10搭建django1.10.3+Apache2.4