<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Li Yue [学习笔记] &#187; apache</title>
	<atom:link href="http://www.liyue.org/tech/archives/tag/apache/feed" rel="self" type="application/rss+xml" />
	<link>http://www.liyue.org/tech</link>
	<description>技术笔记</description>
	<lastBuildDate>Sun, 18 Jul 2010 02:14:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Apache自定义错误信息并跳转到各自网站首页</title>
		<link>http://www.liyue.org/tech/archives/203</link>
		<comments>http://www.liyue.org/tech/archives/203#comments</comments>
		<pubDate>Fri, 08 Jan 2010 06:06:01 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[web优化]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=203</guid>
		<description><![CDATA[一、自定义错误信息页面，并根据所请求的URL所在的域，跳转到所在域名。
二、自定义APACHE错误信息，指定错误信息页面。配置文件里面有例子信息，去掉下面的注释符号#，激活。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    Alias /error/ &#34;/usr/local/apache2/error/&#34;
&#160;
    &#60;Directory &#34;/usr/local/apache2/error&#34;&#62;
        AllowOverride None
        Options IncludesNoExec
        AddOutputFilter Includes html
        AddHandler type-map var
      [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/203/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache性能优化之启用gzip压缩</title>
		<link>http://www.liyue.org/tech/archives/199</link>
		<comments>http://www.liyue.org/tech/archives/199#comments</comments>
		<pubDate>Mon, 30 Nov 2009 13:36:39 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[web优化]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[mod_deflate]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=199</guid>
		<description><![CDATA[首先查看apache是否加载了mod_deflate.so模块，如果没有需要安装加载。
找到并下载和当前apache版本相同的源码文件，解压缩到/home目录下，
在apache安装目录下执行：

/usr/local/apache2/bin/apxs -i -c /home/httpd-2.0.63/modules/filters/mod_deflate.c

会自动在 httpd.conf添加

LoadModule deflate_module modules/mod_deflate.so

添加如下设置：

&#60;IfModule mod_deflate.c&#62;
&#60;Location /&#62;
#Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems…    
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems 
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.59
# the [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/199/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache安全性调整</title>
		<link>http://www.liyue.org/tech/archives/197</link>
		<comments>http://www.liyue.org/tech/archives/197#comments</comments>
		<pubDate>Mon, 30 Nov 2009 12:44:00 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[web优化]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=197</guid>
		<description><![CDATA[对 web服务器进行安全性端口扫描，发现一些问题，apache加以调整：
1、HTTP TRACE method
   需要关闭HTTP TRACE 方法，检测apache是否打开了trace方法，使用如下方法：

  telnet 127.0.0.1 80

   Trying 127.0.0.1&#8230;
Connected to 127.0.0.1.
Escape character is &#8216;^]&#8217;.

TRACE / HTTP/1.0
Host: foo

然后按两次回车，出现下面的信息，证明方法激活了。
HTTP/1.1 200 OK
Date: Sat, 20 Oct 2007 20:39:36 GMT
Server: Apache/2.2.6 (Debian)
Connection: close
Content-Type: message/http
TRACE / HTTP/1.0
Host: foo
否则会出现：
HTTP/1.1 403 Forbidden
等信息。
解决方法：修改httpd.conf，修改如下数值：TraceEnable Off
2、隐藏apache版本等信息：
访问一个不存在的页面，apache会报如下错误：
Not Found
The requested URL /ss.c was not found on this server.
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
Apache/2.0.63 (Unix) DAV/2 [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/197/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache配置支持SHTML</title>
		<link>http://www.liyue.org/tech/archives/180</link>
		<comments>http://www.liyue.org/tech/archives/180#comments</comments>
		<pubDate>Sat, 24 Oct 2009 02:37:36 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[web优化]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=180</guid>
		<description><![CDATA[一、前言
CMS中模板用置标嵌套头尾模板的方法，方便快捷，但是存在弊端，当文档数据量庞大时，只要嵌套的头尾模板稍有改动，就得完全发布站点才能更新所有的文档模板。数据量有几十万条，这个就是噩梦。使用SSI技术，将头尾作为独立文件嵌入到页面中，只要更新发布头尾文件就可以了。
二、Apache配置
	Apache默认是不支持SSI的，更改httpd.conf来进行配置。
搜索“AddType text/html .shtml”，找到下面两行：

# AddType text/html .shtml
# AddOutputFilter INCLUDES .shtml

将这两行前面的#注释去掉。
搜索下面的默认页配置：

DirectoryIndex index.html index.htm

将index.shtml放到第一个位置

DirectoryIndex index.shtml index.html index.htm

接下来修改虚拟主机配置来支持shtml
例如下面的虚拟主机配置：

&#60;VirtualHost *:80&#62;
ServerAdmin webmaster@cas.cn
&#60;Directory &#34;/var/web/casweb/cas&#34;&#62;
Options -Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
&#60;/Directory&#62;
DocumentRoot /var/web/casweb/cas/
ServerName www.cas.cn
ErrorLog logs/www.cas.cn-error_log
TransferLog &#34;&#124;/usr/local/sbin/cronolog /usr/local/apache2/logs/www.cas.cn-%Y%m%d-access_log&#34;
&#60;/VirtualHost&#62;

蓝色的Includes是在原来的基础上增加的。
三、SSI页面调用方法
	用法：

&#60;!--#include virtual=&#34;index.shtml&#34; --&#62;

include路径不能跨域，只能使用相对路径。
	将上述代码插入到模板代码中，并将模板扩展名改为shtml
	链接的文件名可以使用置标来获取，但必须指定具体的文件名，如index.shtml
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/180/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache日志的cronolog轮循</title>
		<link>http://www.liyue.org/tech/archives/102</link>
		<comments>http://www.liyue.org/tech/archives/102#comments</comments>
		<pubDate>Tue, 09 Dec 2008 15:08:27 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[系统]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=102</guid>
		<description><![CDATA[　　将apache日志按年月日目录分类存放，便于日志分析系统分析。使用cronolog来完成，有windows和linux的版本。Linux安装，解压缩后执行
　　#./configure
　　#./make
　　#./make install
　　在httpd.conf配置使用cronolog，在每个虚拟主机中，加入
　　

CustomLog &#34;&#124;/usr/local/sbin/cronolog /var/logs/%Y/%m/%Y%m%d_access.log&#34; combined
　　ErrorLog &#34;&#124;/usr/local/sbin/cronolog /var/logs/%Y/%m/%Y%m%d_error.log&#34;

　　Windows下cronolog安装，解压缩后，将cronolog.exe文件放到apache安装目录的bin下。配置httpd.conf

TransferLog &#34;&#124;D:/Apache/bin/cronolog.exe D:/Apache/logs/%Y/%m/%d/access.log&#34;
	ErrorLog    &#34;&#124;D:/Apache/bin/cronolog.exe D:/Apache/logs/%Y/%m/%d/access.log&#34;

]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/102/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache2.2.9/tomcat5.5.16整合</title>
		<link>http://www.liyue.org/tech/archives/62</link>
		<comments>http://www.liyue.org/tech/archives/62#comments</comments>
		<pubDate>Wed, 24 Sep 2008 04:06:13 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=62</guid>
		<description><![CDATA[　　1、Apache2.2.9的安装只用了一个配置命令：
　　　　./configure &#8211;prefix=/usr/local/apache &#8211;enable-rewrite=shared
　　2、Tomcat5.5.16二进制方式，解压。
　　3、安装jakarta-tomcat-connectors-jk2-src-current.tar.gz
　　　　下载地址：http://archive.apache.org/dist/jakarta/tomcat-connectors/jk2/source/
　　　　解压后，进入到jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2目录
　　　　执行./configure &#8211;with-apxs2=/usr/local/apache/bin/apxs
　　　　　　make
　　　　拷贝mod_jk2.so文件，到apache的modules目录。
　　　　cp jakarta-tomcat-connectors-jk2-2.0.4-src/jk/build/jk2/apache2/mod_jk2.so
　　　　　　/usr/local/apache/modules/
　　4、配置apache配置文件：
　　　　编辑httpd.conf
　　　　Listen 10.10.10.197:80下面添加一行，加载mod_jk2.so.
　　　　LoadModule jk2_module modules/mod_jk2.so
　　　　找到下面一行，并且去掉注释符号#，加载虚拟主机配置文件
　　　　Include conf/extra/httpd-vhosts.conf
　　5、配置虚拟主机：

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
&#60;VirtualHost *&#62;
    ServerAdmin web@domain.com
    DocumentRoot &#34;/usr/local/tomcat/webapps&#34;
#需要转给tomcat处理的文件名，如*.jsp，这里是*.*所有文件处理转给tomcat 
    &#60;Location ~ &#34;/*.*&#34;&#62;
            JkUriSet worker ajp13:localhost:8009
        &#60;/Location&#62;
    ServerName search.domain.com
  [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/62/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SELinux对Apache限制和小插曲</title>
		<link>http://www.liyue.org/tech/archives/29</link>
		<comments>http://www.liyue.org/tech/archives/29#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:16:51 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=29</guid>
		<description><![CDATA[
　　CentOS4.6自带APACHE不能更改默认根目录，虚拟主机指向其他目录不认。是SELinux激活的原因，关闭他：
# vi /etc/selinux/config
 # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing &#8211; SELinux security policy is enforced.
#       permissive &#8211; SELinux prints warnings instead of enforcing.
#       disabled &#8211; SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted &#8211; Only targeted network [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/29/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache授权访问</title>
		<link>http://www.liyue.org/tech/archives/13</link>
		<comments>http://www.liyue.org/tech/archives/13#comments</comments>
		<pubDate>Thu, 07 Aug 2008 13:43:19 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=13</guid>
		<description><![CDATA[背景：
 我们公司的web服务器是linux+apache,自己有一个内部交流的OA放在web服务器上，同时还有一些外部的网站。其中内部的OA除了公司的人其他人是不允许访问的。仅依靠OA系统本身的登陆验证不够。需要对整个OA程序从文件角度验证。这就利用apache身份验证。
 采用“用户名+密码”以文本文件为存储方式的认证。
方法：
 一、修改apache的配置文件。
  
      Options +Indexes FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
  
  这是发布目录的根目录。需要对根目录下的bbs目录验证。增加一段：
  
      Options +Indexes FollowSymLinks
      AllowOverride authconfig
      Order allow,deny
      Allow from all
  
 二、在限制访问的目录bbs下，建立一个文件.htaccess 内容如下：
  authname &#8220;beijing OA&#8221;
  authtype basic
  authuserfile /etc/.passwd
  require valid-user
 三、用apache自带的htpasswd,生成包含用户名和密码的文本文件。每行内容格式为“用户名：
密码”。
  # htpasswd -bc /etc/.passwd bj password (创建新的密码文件并添加用户)
  增加用户：
  # htpasswd -b /etc/.passwd admin password (在密码文件中添加用户)
  删除用户：
  # htpasswd -D /etc/.passwd bj

]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/13/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
