当前位置: 首页 > 工具软件 > mod-gzip-disk > 使用案例 >

mod_jk(Apache+mod_jk+tomcat)配置全攻略

蒙光华
2023-12-01

首先虽然这个mod_jk已经过时,但还是放出来大家一起学习一下,文章主要分三部分内容:

1.第一部分:说明主要配置过程

2.第二部分:贴出我的httpd.conf文件

3.第三部分:对mod_jk代码讲解(来源百度)

 

第一部分:配置

1.       准备环境:

操作系统:windows7

httpd-2.2.21-win32-x86-no_ssl.msi

apache-tomcat-6.0.7

apache-tomcat-5.0.7

tomcat-connectors-1.2.32-windows-i386-httpd-2.2.x

2.       下载APACHE

这里下载的是APACHE2.2.21版本

3.       下载JK(Tomcat Connector)

Jk是apache和tomcat的连接器,也可以做负载均衡器,主要是apache通过jk找到tomcat。

下载地址:http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/

Jk的版本要与apache的版本对应如:mod_jk-1.2.32-httpd-2.2.x.zip其匹配的Apache为2.2.版本以上可用

4.       下载TOMCAT

apache-tomcat-6.0.7.rar

apache-tomcat-6.0.7.rar

5.       配置修改过程

1)  Apache配置

将Tomcat Connector文件mod_jk.so拷贝到Apache安装目录的modules目录下。

在Apache安装目录下找到conf/httpd.conf文件,使用文本编辑器打开:

伪静态修改

将注释放开

找到AllowOverride None 将其修改为 All 内容如下:

[html] view plaincopyprint?

  1. <Directory />  
  2.   
  3.     Options FollowSymLinks  
  4.   
  5.     AllowOverride All  
  6.   
  7.     Order deny,allow  
  8.   
  9.     Deny from all  
  10.   
  11. </Directory>  

Tomcat Connector关联项增加

        在LoadModules末尾处增加一下内容:

[plain] view plaincopyprint?

  1. #加载mod_jk连接  
  2.   
  3. LoadModule jk_module modules/mod_jk.so  
  4.   
  5. ### 配置 mod_jk  
  6.   
  7. JkWorkersFile "conf\workers.properties" #加载集群中的workers  
  8.   
  9. #此处是指定分配给tomcat的请求 例如*.do *.jsp  
  10.   
  11. JkMount /*.jsp controller  
  12.   
  13. JkLogFile logs/mod_jk.log #指定jk的日志输出文件   
  14.   
  15. JkLogLevel warn #指定日志级别  
  16.   
  17.     找到IfModule dir_module 修改默认访问地址,需要根据具体项目实际情况填写,我这里使用的是index.jsp 修改如下:  
  18.   
  19. <IfModule dir_module>  
  20.   
  21. DirectoryIndex index.jsp  
  22.   
  23. </IfModule>  
  24.   
  25.     找到Virtual hosts 去掉虚拟主机注释  
  26.   
  27. # Virtual hosts  
  28.   
  29. #Include conf/extra/httpd-vhosts.conf 将 “#”去掉  
  30.   
  31. Include conf/extra/httpd-vhosts.conf  
  32.   
  33. 加载代理(暂时未去掉)  
  34.   
  35. #LoadModule proxy_module modules/mod_proxy.so  
  36.   
  37. #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so  
  38.   
  39. #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so  
  40.   
  41. #LoadModule proxy_connect_module modules/mod_proxy_connect.so  
  42.   
  43. #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so  

2)  Tomcat Connector配置

在Apache配置目录Apache2.2\conf创建workers.properties配置文件,该文件主要用于配置Apache与Tomcat的集成要用到的Tomcat实例和负载均衡分发控制器。

Workers.properties文件放置一下内容;

[plain] view plaincopyprint?

  1. #下面是分发控制器 注意不要放tomcat实例  
  2.   
  3. worker.list=lbcontroller  
  4.   
  5.    
  6.   
  7. #Tomcat1实例配置 这里要和Tomcat配置文件Service.xml的jvmRoute保持一致  
  8.   
  9. worker.test1.host=localhost  
  10.   
  11. worker.test1.port=8009  
  12.   
  13. worker.test1.type=ajp13  
  14.   
  15. #分发权重 值越大负载越大  
  16.   
  17. worker.tomcat1.lbfactor=1  
  18.   
  19.    
  20.   
  21. #Tomcat2实例配置  
  22.   
  23. worker.test2.host=localhost  
  24.   
  25. worker.test2.port=9009  
  26.   
  27. worker.test2.type=ajp13  
  28.   
  29. #分发权重 值越大负载越大  
  30.   
  31. worker.tomcat2.lbfactor=1  
  32.   
  33.    
  34.   
  35. #负载均衡分发控制器  
  36.   
  37. worker.lbcontroller.type=lb  
  38.   
  39. worker.lbcontroller.balance_workers=test1,test2  

Tomcat配置文件Service.xml主要注意两个地方,一个是Engine节点需要增加节点标识jvmRoute,一个是将原本注释掉的Session复制节点改为有效。具体如下:

  

[html] view plaincopyprint?

  1. <!--jvmRoute在各个Tomcat配置中不能重复且要与worker.properties文件中的名称一致-->  
  2.   
  3.     <Engine name="Catalina" defaultHost="localhost" jvmRoute="test1">  
  4.   
  5.    
  6.   
  7. <!--session复制内容-->  
  8.   
  9.        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"    
  10.   
  11.                  channelSendOptions="8">     
  12.   
  13.           <Manager className="org.apache.catalina.ha.session.DeltaManager"    
  14.   
  15.                    expireSessionsOnShutdown="false"    
  16.   
  17.                    notifyListenersOnReplication="true"/>     
  18.   
  19.     
  20.   
  21. <Channel className="org.apache.catalina.tribes.group.GroupChannel">     
  22.   
  23. <Membership className="org.apache.catalina.tribes.membership.McastService"    
  24.   
  25.                         address="228.0.0.4"    
  26.   
  27.                         port="45564"    
  28.   
  29.                         frequency="500"    
  30.   
  31.                         dropTime="3000"/>     
  32.   
  33. <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"    
  34.   
  35.                       address="auto"    
  36.   
  37.                       port="4000"    
  38.   
  39.                       autoBind="100"    
  40.   
  41.                       selectorTimeout="5000"    
  42.   
  43.                       maxThreads="6"/>     
  44.   
  45.             <!-- timeout="60000"-->     
  46.   
  47.             <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">     
  48.   
  49.               <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender" />     
  50.   
  51.             </Sender>     
  52.   
  53.             <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>     
  54.   
  55.             <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>     
  56.   
  57.             <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>     
  58.   
  59.           </Channel>     
  60.   
  61.           <!--过滤的文件-->  
  62.   
  63.           <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"  filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>     
  64.   
  65.           <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>     
  66.   
  67.     
  68.   
  69.           <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"    
  70.   
  71.                     tempDir="/tmp/war-temp/"    
  72.   
  73.                     deployDir="/tmp/war-deploy/"    
  74.   
  75.                     watchDir="/tmp/war-listen/"    
  76.   
  77.                     watchEnabled="false"/>     
  78.   
  79.           <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>     
  80.   
  81.           <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>     
  82.   
  83.         </Cluster>  
  84.   
  85.       <!--session复制内容-->  

            <!—Host节点增加一下内容表示站点根路径-->

[html] view plaincopyprint?

  1. <Context path="/sc" docBase="." privileged="true"/>                                                           

我们分别将两个Tomcat配置文件中的jvmRoute设置为tomcat1、tomcat2,Server节点 端口分别配置为8005和9005, Connector节点端口分别配置为8080和9090,AJPConnector端口分别配置为8009和9009,Connector端口配置参照单主机多站点场景。请注意两个Tomcat配置文件Host节点的域名配置必须一样,Server.xml中的jvmRoute名称必须和worker.properties中的tomcat实例名称一致,不然无法实现session_stricky。

 

[html] view plaincopyprint?

  1. *****************************************************************************  
  2.   
  3.  如果需要实现session 复制 需要在Tomcat 下conf/web.xml 中加上<distributable/>  
  4.   
  5. <?xml version="1.0" encoding="ISO-8859-1"?>  
  6.   
  7. 省略N多代码。。。。。。  
  8.   
  9.     <welcome-file-list>  
  10.   
  11.         <welcome-file>index.html</welcome-file>  
  12.   
  13.         <welcome-file>index.htm</welcome-file>  
  14.   
  15.         <welcome-file>index.jsp</welcome-file>  
  16.   
  17.     </welcome-file-list>  
  18.   
  19. <distributable/>  
  20.   
  21. </web-app>  
  22.   
  23. *****************************************************************************  

 

第二部分:httpd.conf文件

[html] view plaincopyprint?

  1.   

[html] view plaincopyprint?

  1. #  
  2. # This is the main Apache HTTP server configuration file.  It contains the  
  3. # configuration directives that give the server its instructions.  
  4. # See <URL:http://httpd.apache.org/docs/2.2> for detailed information.  
  5. # In particular, see   
  6. # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>  
  7. # for a discussion of each configuration directive.  
  8. #  
  9. # Do NOT simply read the instructions in here without understanding  
  10. # what they do.  They're here only as hints or reminders.  If you are unsure  
  11. # consult the online docs. You have been warned.    
  12. #  
  13. # Configuration and logfile names: If the filenames you specify for many  
  14. # of the server's control files begin with "/" (or "drive:/" for Win32), the  
  15. # server will use that explicit path.  If the filenames do *not* begin  
  16. # with "/", the value of ServerRoot is prepended -- so "logs/foo.log"  
  17. # with ServerRoot set to "D:/Program Files/Apache Software Foundation/Apache2.2" will be interpreted by the  
  18. # server as "D:/Program Files/Apache Software Foundation/Apache2.2/logs/foo.log".  
  19. #  
  20. # NOTE: Where filenames are specified, you must use forward slashes  
  21. # instead of backslashes (e.g., "c:/apache" instead of "c:\apache").  
  22. # If a drive letter is omitted, the drive on which httpd.exe is located  
  23. # will be used by default.  It is recommended that you always supply  
  24. # an explicit drive letter in absolute paths to avoid confusion.  
  25.   
  26. #  
  27. # ServerRoot: The top of the directory tree under which the server's  
  28. # configuration, error, and log files are kept.  
  29. #  
  30. # Do not add a slash at the end of the directory path.  If you point  
  31. # ServerRoot at a non-local disk, be sure to point the LockFile directive  
  32. # at a local disk.  If you wish to share the same ServerRoot for multiple  
  33. # httpd daemons, you will need to change at least LockFile and PidFile.  
  34. #  
  35. ServerRoot "D:/Program Files/Apache Software Foundation/Apache2.2"  
  36.   
  37. #  
  38. # Listen: Allows you to bind Apache to specific IP addresses and/or  
  39. # ports, instead of the default. See also the <VirtualHost>  
  40. # directive.  
  41. #  
  42. # Change this to Listen on specific IP addresses as shown below to   
  43. # prevent Apache from glomming onto all bound IP addresses.  
  44. #  
  45. #Listen 12.34.56.78:80  
  46. Listen 8080  
  47.   
  48. #  
  49. # Dynamic Shared Object (DSO) Support  
  50. #  
  51. # To be able to use the functionality of a module which was built as a DSO you  
  52. # have to place corresponding `LoadModule' lines at this location so the  
  53. # directives contained in it are actually available _before_ they are used.  
  54. # Statically compiled modules (those listed by `httpd -l') do not need  
  55. # to be loaded here.  
  56. #  
  57. # Example:  
  58. # LoadModule foo_module modules/mod_foo.so  
  59. #  
  60. LoadModule actions_module modules/mod_actions.so  
  61. LoadModule alias_module modules/mod_alias.so  
  62. LoadModule asis_module modules/mod_asis.so  
  63. LoadModule auth_basic_module modules/mod_auth_basic.so  
  64. #LoadModule auth_digest_module modules/mod_auth_digest.so  
  65. #LoadModule authn_alias_module modules/mod_authn_alias.so  
  66. #LoadModule authn_anon_module modules/mod_authn_anon.so  
  67. #LoadModule authn_dbd_module modules/mod_authn_dbd.so  
  68. #LoadModule authn_dbm_module modules/mod_authn_dbm.so  
  69. LoadModule authn_default_module modules/mod_authn_default.so  
  70. LoadModule authn_file_module modules/mod_authn_file.so  
  71. #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so  
  72. #LoadModule authz_dbm_module modules/mod_authz_dbm.so  
  73. LoadModule authz_default_module modules/mod_authz_default.so  
  74. LoadModule authz_groupfile_module modules/mod_authz_groupfile.so  
  75. LoadModule authz_host_module modules/mod_authz_host.so  
  76. #LoadModule authz_owner_module modules/mod_authz_owner.so  
  77. LoadModule authz_user_module modules/mod_authz_user.so  
  78. LoadModule autoindex_module modules/mod_autoindex.so  
  79. #LoadModule cache_module modules/mod_cache.so  
  80. #LoadModule cern_meta_module modules/mod_cern_meta.so  
  81. LoadModule cgi_module modules/mod_cgi.so  
  82. #LoadModule charset_lite_module modules/mod_charset_lite.so  
  83. #LoadModule dav_module modules/mod_dav.so  
  84. #LoadModule dav_fs_module modules/mod_dav_fs.so  
  85. #LoadModule dav_lock_module modules/mod_dav_lock.so  
  86. #LoadModule dbd_module modules/mod_dbd.so  
  87. #LoadModule deflate_module modules/mod_deflate.so  
  88. LoadModule dir_module modules/mod_dir.so  
  89. #LoadModule disk_cache_module modules/mod_disk_cache.so  
  90. #LoadModule dumpio_module modules/mod_dumpio.so  
  91. LoadModule env_module modules/mod_env.so  
  92. #LoadModule expires_module modules/mod_expires.so  
  93. #LoadModule ext_filter_module modules/mod_ext_filter.so  
  94. #LoadModule file_cache_module modules/mod_file_cache.so  
  95. #LoadModule filter_module modules/mod_filter.so  
  96. #LoadModule headers_module modules/mod_headers.so  
  97. #LoadModule ident_module modules/mod_ident.so  
  98. #LoadModule imagemap_module modules/mod_imagemap.so  
  99. LoadModule include_module modules/mod_include.so  
  100. #LoadModule info_module modules/mod_info.so  
  101. LoadModule isapi_module modules/mod_isapi.so  
  102. #LoadModule ldap_module modules/mod_ldap.so  
  103. #LoadModule logio_module modules/mod_logio.so  
  104. LoadModule log_config_module modules/mod_log_config.so  
  105. #LoadModule log_forensic_module modules/mod_log_forensic.so  
  106. #LoadModule mem_cache_module modules/mod_mem_cache.so  
  107. LoadModule mime_module modules/mod_mime.so  
  108. #LoadModule mime_magic_module modules/mod_mime_magic.so  
  109. LoadModule negotiation_module modules/mod_negotiation.so  
  110. #LoadModule proxy_module modules/mod_proxy.so  
  111. #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so  
  112. #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so  
  113. #LoadModule proxy_connect_module modules/mod_proxy_connect.so  
  114. #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so  
  115. #LoadModule proxy_http_module modules/mod_proxy_http.so  
  116. #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so  
  117. #LoadModule reqtimeout_module modules/mod_reqtimeout.so  
  118. #url伪静态  
  119. LoadModule rewrite_module modules/mod_rewrite.so  
  120. LoadModule setenvif_module modules/mod_setenvif.so  
  121. #LoadModule speling_module modules/mod_speling.so  
  122. #LoadModule ssl_module modules/mod_ssl.so  
  123. #LoadModule status_module modules/mod_status.so  
  124. #LoadModule substitute_module modules/mod_substitute.so  
  125. #LoadModule unique_id_module modules/mod_unique_id.so  
  126. #LoadModule userdir_module modules/mod_userdir.so  
  127. #LoadModule usertrack_module modules/mod_usertrack.so  
  128. #LoadModule version_module modules/mod_version.so  
  129. #LoadModule vhost_alias_module modules/mod_vhost_alias.so  
  130.   
  131. #加载mod_jk连接  
  132. LoadModule jk_module modules/mod_jk.so  
  133. #加载集群中的workers  
  134. JkWorkersFile "conf/workers.properties"   
  135. #此处是指定分配给tomcat的请求 例如*.do *.jsp  
  136. JkMount /*.jsp lbcontroller  
  137. #指定jk的日志输出文件  
  138. JkLogFile "logs/mod_jk.log"  
  139. #指定日志级别  
  140. JkLogLevel warn   
  141.   
  142.   
  143.   
  144.   
  145. <IfModule !mpm_netware_module>  
  146. <IfModule !mpm_winnt_module>  
  147. #  
  148. # If you wish httpd to run as a different user or group, you must run  
  149. # httpd as root initially and it will switch.    
  150. #  
  151. # User/Group: The name (or #number) of the user/group to run httpd as.  
  152. # It is usually good practice to create a dedicated user and group for  
  153. # running httpd, as with most system services.  
  154. #  
  155. User daemon  
  156. Group daemon  
  157.   
  158. </IfModule>  
  159. </IfModule>  
  160.   
  161. # 'Main' server configuration  
  162. #  
  163. # The directives in this section set up the values used by the 'main'  
  164. # server, which responds to any requests that aren't handled by a  
  165. # <VirtualHost> definition.  These values also provide defaults for  
  166. # any <VirtualHost> containers you may define later in the file.  
  167. #  
  168. # All of these directives may appear inside <VirtualHost> containers,  
  169. # in which case these default settings will be overridden for the  
  170. # virtual host being defined.  
  171. #  
  172.   
  173. #  
  174. # ServerAdmin: Your address, where problems with the server should be  
  175. # e-mailed.  This address appears on some server-generated pages, such  
  176. # as error documents.  e.g. admin@your-domain.com  
  177. #  
  178. ServerAdmin localhost  
  179.   
  180. #  
  181. # ServerName gives the name and port that the server uses to identify itself.  
  182. # This can often be determined automatically, but we recommend you specify  
  183. # it explicitly to prevent problems during startup.  
  184. #  
  185. # If your host doesn't have a registered DNS name, enter its IP address here.  
  186. #  
  187. ServerName localhost:8080  
  188. #  
  189. # DocumentRoot: The directory out of which you will serve your  
  190. # documents. By default, all requests are taken from this directory, but  
  191. # symbolic links and aliases may be used to point to other locations.  
  192. #  
  193. DocumentRoot "D:/work/work_bz/test/WebRoot"  
  194. #  
  195. # Each directory to which Apache has access can be configured with respect  
  196. # to which services and features are allowed and/or disabled in that  
  197. # directory (and its subdirectories).   
  198. #  
  199. # First, we configure the "default" to be a very restrictive set of   
  200. # features.    
  201. #    默认为 AllowOverride None  
  202. <Directory />  
  203.     Options FollowSymLinks  
  204.     AllowOverride All  
  205.     #Order deny,allow  
  206.       #Deny from all  
  207.        Order allow,deny  
  208.     Allow from all  
  209.     Satisfy all  
  210. </Directory>  
  211.   
  212. #首次访问页面  
  213. <IfModule dir_module>  
  214.     DirectoryIndex index.jsp  
  215. </IfModule>  
  216.   
  217. #  
  218. # The following lines prevent .htaccess and .htpasswd files from being   
  219. # viewed by Web clients.   
  220. #  
  221. <FilesMatch "^\.ht">  
  222.     Order allow,deny  
  223.     Deny from all  
  224.     Satisfy All  
  225. </FilesMatch>  
  226.   
  227. #  
  228. # ErrorLog: The location of the error log file.  
  229. # If you do not specify an ErrorLog directive within a <VirtualHost>  
  230. # container, error messages relating to that virtual host will be  
  231. # logged here.  If you *do* define an error logfile for a <VirtualHost>  
  232. # container, that host's errors will be logged there and not here.  
  233. #  
  234. ErrorLog "logs/error.log"  
  235.   
  236. #  
  237. # LogLevel: Control the number of messages logged to the error_log.  
  238. # Possible values include: debug, info, notice, warn, error, crit,  
  239. # alert, emerg.  
  240. #  
  241. LogLevel warn  
  242.   
  243. <IfModule log_config_module>  
  244.     #  
  245.     # The following directives define some format nicknames for use with  
  246.     # a CustomLog directive (see below).  
  247.     #  
  248.     LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined  
  249.     LogFormat "%h %l %u %t \"%r\" %>s %b" common  
  250.   
  251.     <IfModule logio_module>  
  252.       # You need to enable mod_logio.c to use %I and %O  
  253.       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio  
  254.     </IfModule>  
  255.   
  256.     #  
  257.     # The location and format of the access logfile (Common Logfile Format).  
  258.     # If you do not define any access logfiles within a <VirtualHost>  
  259.     # container, they will be logged here.  Contrariwise, if you *do*  
  260.     # define per-<VirtualHost> access logfiles, transactions will be  
  261.     # logged therein and *not* in this file.  
  262.     #  
  263.     CustomLog "logs/access.log" common  
  264.   
  265.     #  
  266.     # If you prefer a logfile with access, agent, and referer information  
  267.     # (Combined Logfile Format) you can use the following directive.  
  268.     #  
  269.     #CustomLog "logs/access.log" combined  
  270. </IfModule>  
  271.   
  272. <IfModule alias_module>  
  273.     #  
  274.     # Redirect: Allows you to tell clients about documents that used to   
  275.     # exist in your server's namespace, but do not anymore. The client   
  276.     # will make a new request for the document at its new location.  
  277.     # Example:  
  278.     # Redirect permanent /foo http://192.168.12.242/bar  
  279.   
  280.     #  
  281.     # Alias: Maps web paths into filesystem paths and is used to  
  282.     # access content that does not live under the DocumentRoot.  
  283.     # Example:  
  284.     # Alias /webpath /full/filesystem/path  
  285.     #  
  286.     # If you include a trailing / on /webpath then the server will  
  287.     # require it to be present in the URL.  You will also likely  
  288.     # need to provide a <Directory> section to allow access to  
  289.     # the filesystem path.  
  290.   
  291.     #  
  292.     # ScriptAlias: This controls which directories contain server scripts.   
  293.     # ScriptAliases are essentially the same as Aliases, except that  
  294.     # documents in the target directory are treated as applications and  
  295.     # run by the server when requested rather than as documents sent to the  
  296.     # client.  The same rules about trailing "/" apply to ScriptAlias  
  297.     # directives as to Alias.  
  298.     #  
  299.     ScriptAlias /cgi-bin/ "D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"  
  300.   
  301. </IfModule>  
  302.   
  303. <IfModule cgid_module>  
  304.     #  
  305.     # ScriptSock: On threaded servers, designate the path to the UNIX  
  306.     # socket used to communicate with the CGI daemon of mod_cgid.  
  307.     #  
  308.     #Scriptsock logs/cgisock  
  309. </IfModule>  
  310.   
  311. #  
  312. # "D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin" should be changed to whatever your ScriptAliased  
  313. # CGI directory exists, if you have that configured.  
  314. #  
  315. <Directory "D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">  
  316.     AllowOverride None  
  317.     Options None  
  318.     Order allow,deny  
  319.     Allow from all  
  320. </Directory>  
  321.   
  322. #  
  323. # DefaultType: the default MIME type the server will use for a document  
  324. # if it cannot otherwise determine one, such as from filename extensions.  
  325. # If your server contains mostly text or HTML documents, "text/plain" is  
  326. # a good value.  If most of your content is binary, such as applications  
  327. # or images, you may want to use "application/octet-stream" instead to  
  328. # keep browsers from trying to display binary files as though they are  
  329. # text.  
  330. #  
  331. DefaultType text/plain  
  332.   
  333. <IfModule mime_module>  
  334.     #  
  335.     # TypesConfig points to the file containing the list of mappings from  
  336.     # filename extension to MIME-type.  
  337.     #  
  338.     TypesConfig conf/mime.types  
  339.   
  340.     #  
  341.     # AddType allows you to add to or override the MIME configuration  
  342.     # file specified in TypesConfig for specific file types.  
  343.     #  
  344.     #AddType application/x-gzip .tgz  
  345.     #  
  346.     # AddEncoding allows you to have certain browsers uncompress  
  347.     # information on the fly. Note: Not all browsers support this.  
  348.     #  
  349.     #AddEncoding x-compress .Z  
  350.     #AddEncoding x-gzip .gz .tgz  
  351.     #  
  352.     # If the AddEncoding directives above are commented-out, then you  
  353.     # probably should define those extensions to indicate media types:  
  354.     #  
  355.     AddType application/x-compress .Z  
  356.     AddType application/x-gzip .gz .tgz  
  357.   
  358.     #  
  359.     # AddHandler allows you to map certain file extensions to "handlers":  
  360.     # actions unrelated to filetype. These can be either built into the server  
  361.     # or added with the Action directive (see below)  
  362.     #  
  363.     # To use CGI scripts outside of ScriptAliased directories:  
  364.     # (You will also need to add "ExecCGI" to the "Options" directive.)  
  365.     #  
  366.     #AddHandler cgi-script .cgi  
  367.   
  368.     # For type maps (negotiated resources):  
  369.     #AddHandler type-map var  
  370.   
  371.     #  
  372.     # Filters allow you to process content before it is sent to the client.  
  373.     #  

 类似资料: