码迷,mamicode.com
首页 > Windows程序 > 详细

windows2008 apache2.4 tomcat-7多域名绑定环境配置

时间:2018-04-19 00:32:43      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:tomcat   root   UI   images   webapp   https   download   apache2   txt   

=====================软件清单
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 webmaster@dummy-host.example.com
    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 &quot;%r&quot; %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多域名绑定环境配置

标签:tomcat   root   UI   images   webapp   https   download   apache2   txt   

原文地址:https://www.cnblogs.com/beenupper/p/8878618.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!