android美化初级篇(已更新反编译apktool教程)

持续更新中。。。。。。。

前言:今日忽然良心发现,从此告别伸手党。前两天考试结束,就开始闲的蛋疼,索性开始看各种教程,本人N小时之前也是小小白,现在已经跻身小白之列。由于几乎一点计算机技术都不会,教程也是看的晕晕乎乎,头昏脑胀。不过还是搞成功了一些东西,特来分享一些经验。由于没什么实力,也只能各方借鉴来完成一下教程。在此说明,之前看各前辈教程的时候,有用的自己就复制下来到自己电脑,现在写教程,好多就不知道谁是原作者,所以恳请大家见谅。下面肯定有不足之处,甚至错误,欢迎指正,不胜感激。

 好了,废话少说,直接开始教程了。。。。。。。近来主要看了反编译之类的教程,先分享这方面知识

Java环境配置

————————————————————————————————————

要想使用apktool等工具,首先必须搭建java环境

请自己下载JDK(到处可以找到,看好自己是32-bit还是64-bit,对应下载。我就不上传了),安装,我是安装在       C:\Program Files\Java\jdk1.7.0     要记住安装位置,待会儿用的着。

接着(以win7示例,xp也差不多)以此打开   计算机-属性-高级系统设置-高级-环境变量,

如下图

点击系统变量(s)下的新建按钮

新建     变量名    JAVA_HOME
变量值为   C:\Program Files\Java\jdk1.7.0(即刚才的安装路径,视自己情况而定)

同理

新建     变量名     PATH
变量值    %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin

新建    变量名 CLASSPATH
变量值 .;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar

最后保存下配置。。。。。

至此,java环境已经配置成功。为了保险起见,我们来验证一下

打开CMD(开始-附件-命令提示符   或者  win+R)

输入javac或者java,回车如果出现以下类似帮助,哈哈,恭喜你

——————————————————————————————

Apktool工具的使用

接下来主角出场啦,就是apktool,虽说这个工具网上到处都是,但好多不能编译4.0的apk。所以但我极力推荐下面这个(虽说比起其他的麻烦一些,但成功率是我见过最高的,为某些懒惰的机友着想,我也做了些傻瓜处理),这个工具我找的好辛苦的啊。

 

 

 

 

下载下来之后,解压到任意路径。(建议是某个盘的根目录,好找,哈哈)

我的是这样的

这个工具基本只有以下两个命令:

一、apktool d XX.apk YY

 apktool d为反编译命令,其中d代表decode
XX.apk为需要反编译的apk的文件名(XX最好不要带汉字)

YY为存放反编译后的文件的文件夹(随你便,也不要为汉字。。。。YY也可以省略,默认放在XX文件夹内,建议直接省略)

二、命令说明:apktool b YY(上面省略的话就是XX,哈哈)
 apktool b为重新编译命令
YY为需要编译的目录(就是存放刚刚你定义的文件夹,上面省略的话就是XX)

实战
下面我以RE管理器(非系统文件)为例(刚好桌面上有一个,哈哈,直接拿来用)

1傻瓜方式

1、        将“re管理器.apk”拉进apktool文件夹内,如下:

 

2、        将“re管理器.apk”改名为“0.apk”(是零,不是O)

3、        双击“点我反编译.bat”,然后等。。。。等。。。。等。。。。。。。。。。。。然后就发现多了一个文件名为0文件夹。

4、        由于是学习阶段,暂时不做修改,直接双击“点我回编译.bat”回编译感受下成功的喜悦。看着窗口,你就知道生成的apk在哪里了。(吊吊胃口,谁用谁知道)

5、        当然,你以后做到这一步,还需要签名才能安装。签名工具最后又下载,下了你就会用。

 

2手动方式(以4.04系统文件systemui.apk修改1%电量为例)

1、        将systemui.apk还有framework-res.apk(很重要)放入apktool文件夹下

2、        接着打开CMD窗口,输入e:  (回车)

3、    再输入cd apktool(回车)   结果如下:

 

4、        接着输入:apktool if framework-res.apk(回车),这一步是加载框架,反编译系统程序时很必要。但是我这个版本可以省略这一步的,为安全起见,我顺便也做了这步

5、        输入apktool d systemui.apk(回车),看到下面就成功一半了

6、

然后你就可以修改新生成的systemui文件夹里边的文件了(可没让你乱改,哈哈)现在就可以将1%电池脚本替换到apktool\systemui\res\drawable里边了。如下

 

7、        然后将你需要的电量图标复制到apktool\systemui\re s\drawable-hdpi里边。

8、        回编译,CMD窗口输入apktool b systemui(回车)出现下面画面,你就有希望成功了。

9、        最后,很重要的一步,你看不到自己卡M了不要怪我哈。这里将原始apk称为A,新生成的apk称为B。以方便下面叙述。将A,B均用winrar打开,不要解压。

 

第一,(还有第二哦)将B中的resources.arsc文件拉到A中替换,压缩方式改为存储。切记

 

 

 

第二步:将B中的电量脚本拉到A中进行替换,方法参考上面。B中的drawable-hdpi文件夹也拉进A中替换。大功告成,佩服你自己吧。

最后,修改好的A就可以替换到你的手机啦,不过切记要先改权限,相信大家都懂的。

 

总结:系统apk的反编译是不需要签名的,但最后要进行替换。如上。

一共要替换两类:

1resources.arsc文件

2回编译之前修改过的文件。如例子中的电量脚本与电量图标所在的drawable-hdpi文件夹。

工具包下载  apktool及签名

整整编了一个下午。饭都没吃有木有。既然看到这里了,不介意给我点鼓励吧,哈哈

 

centos 6下编译安装php时安装mcrypt支持库

centos6本身不带mcrypt库的支持,手工编译php时,还需要先安装该库,这里有两个途径

1. 使用第三方源实现yum安装,推荐使用RPMforge,在centos下配置该yum源,配置后即可尝试yum install libmcrypt, yum install libmcrypt-devel, yum install mcrypt-devel 安装该库。本人没有实际操作,不确定具体该包的包名。因为如果使用该库,就没必要手工编译php了,直接yum安装好了。配置RPMforge如下

 rpm -ivh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
 yum clean all
 yum makecache

请参看RPMforge, 很不错的centos RPM/yum源

2. 手工编译安装mcrypt库的支持。

这才是本文主要针对的,手工编译。按php官方的说明 http://www.php.net/manual/en/mcrypt.requirements.php

These functions work using » mcrypt. To use it, download libmcrypt-x.x.tar.gz from» http://mcrypt.sourceforge.net/ and follow the included installation instructions

但是http://mcrypt.sourceforge.net/并没有libmcrypt,而是应该到sourceforge上下载,http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/

下载,解压,./configure, make,make install, 很常规的步骤。注意libmcrypt需要c++编译器,请保证安装过gcc-c++, 否则请yum install gcc-c++装之

 

设置ssh自动登录远程主机的配置要点

本地生成的的RSA密钥传需要传到远程主机相应用户家目录下的.ssh子目录下,注意该子目录的权限设置是有严格要求的:其所属用户当然是该用户,其权限应该是700, 即不允许其它用户进入并访问该目录;否则,无法自动登录的。

这种情况下,使用ssh 的-v参数显示详细消息大致如下:

$ ssh -v feng@myremote.host.net
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to myremote.host.net [50.116.14.251] port 22.
debug1: Connection established.
debug1: identity file /home/feng/.ssh/identity type -1
debug1: identity file /home/feng/.ssh/id_rsa type 1
debug1: identity file /home/feng/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'myremote.host.net' is known and matches the RSA host key.
debug1: Found key in /home/feng/.ssh/known_hosts:8
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_501' not found

debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_501' not found

debug1: Unspecified GSS failure.  Minor code may provide more information

debug1: Unspecified GSS failure.  Minor code may provide more information

debug1: Next authentication method: publickey
debug1: Offering public key: /home/feng/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering public key: .ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/feng/.ssh/identity
debug1: Trying private key: /home/feng/.ssh/id_dsa
debug1: Next authentication method: password
feng@myremote.host.net's password:

了解关于ssh免密码登录,强烈推荐这篇文章,基于ssh密钥对的自动登录原理及实际操作

另请参看 ssh无密码登入设置(完全版)/linux下免输入密码ssh登录

linode vps 国内访问速度测试:机房测速

注意:本文内容仅供参考,测得数据并没有广泛的代表性。测试结论参看文后总结。

今天凌晨0点买了个linode的 512vps,久闻其最近日本机房质量严重下降——我指的是在本朝大局域网内访问的速度——有点不是太相信,想亲自测试一下;以后把站点迁移上去之后就不方便这么折腾了。

于是点选了Tokyo JP,ssh连接上去看了看,一个很空的系统,大概是最小化安装的,还是这种环境好,没有乱七八糟的东西,想装什么装什么,省心。太困了,于是睡觉。

起床后开始折腾:

时间:2012-06-09 10:00

安装apache ,在web目录里 wget -r http://blog.path8.net ,搞一点文件,用来测试一下页面打开速度。wget太慢,运行了一两分钟,Ctrl+C中止掉;浏览器打开测试页面,通过firebug的网络检测功能查看,速度跟burstNet vps差不多,甚至更慢。

vps上 wget上去一个linux kernel的bz2包,这可是真正的高压缩文件,测试网速时最喜欢用它了! 在vps上wget,速度基本上在300-500K左右,最高也没超过700K。

这么来看,linode 日本东京机房的网络速度果然不很快。

网上找比较linode几个数据中心的速度方面的文章,都比较老,通过搜索得知linode library中(http://library.linode.com/getting-started#sph_selecting-a-data-center)提供的有测速的链接 http://www.linode.com/speedtest/

============= 这几个测速链接如下: ===================

Use this information to determine the best location for your Linode.

Facility Hostname Test Download
Tokyo, JP speedtest.tokyo.linode.com 100MB-tokyo.bin
London, UK speedtest.london.linode.com 100MB-london.bin
Newark, NJ speedtest.newark.linode.com 100MB-newark.bin
Atlanta, GA speedtest.atlanta.linode.com 100MB-atlanta.bin
Dallas, TX speedtest.dallas.linode.com 100MB-dallas.bin
Fremont, CA speedtest.fremont.linode.com 100MB-fremont.bin

========================================================

上网环境为 中国电信光纤宽带,使用firefox下载一个测试文件1分钟左右,然后断开,再下载下一个。

测速结果大致如下:

数据中心 粗测速度(KB/s)

Tokyo, JP 150~210

London, UK 400~700

Newark, NJ 200~220

Atlanta, GA 400~500

Dallas, TX 400~800

Fremont, CA 100~120

因为正好是美国的夜间,而是日本的白天,这点也会影响实际结果。

换个时间再测一下速度,以使结果更具代表性

12:30再次测试,使用wget 命令,仍下载一部分,加上两个参数:wget第一次显示的速度值,wget第一条日志记录中显示值

数据中心 前10秒平均速度 第一次显示速度 第一条记录中速度

Tokyo, JP 35 (35~26) 33 35

London, UK 400 (220~600) 33 193

Newark, NJ 120 (156~80) 30 156

Atlanta, GA 400 (260~560) 42 289

Dallas, TX 600 (480~900) 49 389

Fremont, CA 140 (120~260) 61 138

总结:

Atlanta, GA 与 Dallas, TX 表现最佳,另外 London, UK 也不错,这点之前是没有想到。

----------------------------------

不过就实际有使用情况来看,在国内访问Dallas, TX机房的网络速度很慢,ping值在几个机房中是最高的,web访问起来,跟burst速度差不多,根本没有体现出linode的形象来。经过一天的使用,请求客服换到Fremont, CA ,使用这个据说有些悲摧的机房,一段时间看看情况再说,看是是真的有带宽拥挤而抽风等情况。据说Atlanta, GA 机房在国内访问也是不错的,不过没有试用。

目前本站vps就是在Fremont, CA机房,速度尚可。

----------------------------------

另外,顺便扯一点:

有不少主机商提供的测速都是做过手脚的:他们提供的文件其实是内容高度重复的文件,甚至是整个文件里都是同一个字符,这样的文件,通过http协议下载时,会自动压缩传递的。所以他们的主机:测速链接的文件下载速度超级的快,但用时时候慢得要死。

而linode的测速文件下载下来后,使用zip、bz2压缩,文件大小都没有减小,也就是说他们提供的测速文件还是很专业的,至少在测速方面,他们根本没有想骗用户。

----------------------------

后记:本文是很早写的。2014年的某天本站已迁移到linode日本,当时网络质量还是不错的,丢包率通常在2%以内。然而在2015年,上海电信连接海外网络质量严重bug,丢包暴增,linode日本平均丢包20-30%;cnn, apple, ms等网站在上海电信丢包率也好不了哪里。所以,网络质量这东西,是动态的,老文章的数据,参考意义不大。

mysql修改配置参数innodb_log_file_size后不能正常工作,在phpmyadmin中innodb表状态为“使用中”

问题:修改mysql配置参数innodb_log_file_size 后,可能无法正常启用,或者innodb表将不能工作,在phpmyadmin中显示为“使用中”

解决方法:先停掉mysql,然后删掉旧innodb日志文件后,再启动mysqld就可以正常启用了.innodb旧日志文件位于mysql data 目录下的ib_logfile0, ib_logfile1 文件

innodb日志文件在linux下的典型位置为 /var/lib/mysql
在windows下则默认位于安装目录下的data子目录里。

原因:是旧的innodb日志文件,与改后的innodb_log_file_size不匹配,所以造成mysql不能正常工作。

redhat/centos 6 linux下mkinitrd 生成initramfs.img文件过大原因及dracut使用

centos 6下自己编译linux内核,完了创建initrd文件,依据以前的的经验mkinitrd

#mkinitrd -v ../initramfs-3.0.32.img 3.0.32

但是输出的消息却与以前的版本不太一样,好像打包进去了很多模块,生成花费时间也很长,完成后,看initramfs文件有100多M,OMG,这么大的文件 /boot目录可放不下(/boot挂在单独的分区下,该分区只有100M大小)。

经过N久的折腾,才发现原来redhat/centos6不再使用原来的mkinitrd,而是使用dracut代替了,mkinitrd实际上只是调用dracut的功能。研究dracut才弄明白,如果只是生成用于grub引导本地硬盘上的linux,需要使用一个参数--hostonly ,这样dracut就不会把过多不必要的模块加载到initramfs.img里,如下

dracut -f -v --hostonly -k '/lib/modules/3.0.32'  ../initramfs-3.0.32.img 3.0.32

这是通过查阅kernel 编译安装的 make install 使用是执行的以下脚本实现的:
sh /path/to/kernel-source/linux-3.0.32/arch/x86/boot/install.sh 3.0.32 arch/x86/boot/bzImage System.map "/boot"

查阅arch/x86/boot/install.sh 文件, 它调用/sbin/installkernel ,然后是/sbin/new-kernel-pkg ,接着是/sbin/dracut

通过分析 /sbin/new-kernel-pkg ,其中290行有如下代码

    if [ -n "$dracut" ]; then
        tool="/sbin/dracut $dracuthostonly -f $initrdfile $version"
    else
    tool="/sbin/mkinitrd --allow-missing -f $initrdfile $version"
    fi

其中变量$dracuthostonly的值是 -H ,在dracut参数里与 --hostonly 同义。

问题至此得解。

apache下对目录开启反向代理

需求:有一个apache站点foobar.mysite.net,其中一个目录里的文件与另一站点的某目录内容完全一致。假设该目录为/php, 是一套php程序,因为它使用了cookie,但cookie不能跨域,所以要分别部署在这两个站点下。这里可以通过反向代理,使对站点http://foobar.mysite.net/php/***的访问实际由http://www.mysite.net/php/***处理。

采用如下的设置,相关代码已经加粗着色(如没有着色,请到这里http://blog.path8.net/archives/5989.html阅读)。其中

<VirtualHost *:80>
    DocumentRoot "/var/www/html/vhosts/foobar.mysite.net/html"
    ServerName foobar.mysite.net
    <IfModule mod_php5.c>
        php_admin_value open_basedir "/var/www/html/vhosts/foobar.mysite.net/html/:/tmp"
    </IfModule>
    ProxyPass /php http://www.mysite.net/php  
    ProxypassReverse /php http://www.mysite.net/php 
    ProxypassReverseCookieDomain www.mysite.net foobar.mysite.net
</VirtualHost>

看参考,对指定目录设置反向代理也是可以的,但没有成功,不知哪里有错误,还请高手指教,配置如下。

#<Directory "/var/www/html/vhosts/foobar.mysite.net/html/php">
#    ProxyPass http://www.mysite.net/php
#    ProxypassReverse http://www.mysite.net/php
#    ProxypassReverseCookieDomain www.mysite.net foobar.mysite.net
#    ProxypassReverseCookiePath /php /php
#</Directory>

 

apache代理模块mod_proxy_html,修改html页面内容的url引用链接

参看apache参考手册proxy相关章节时,无意中发现apche有一个模块,可以实现修改代理页面html里的url引用链接,这正是之前想的一个功能,还真的有。apache实在太全面而强大了。

http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_proxy.html#proxypassreverse

apache中有一个第三方模块可以检查并改写HTML中的URL引用,该模块就是Nick Kew编写的mod_proxy_html

http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_proxy.html#proxypassreverse

从某主机商的虚拟主机上拷出来的apache 主配置文件

从美橙互联虚拟主机上拷出来的apache 主配置文件/etc/httpd/conf/httpd.conf

#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See for detailed information.
# In particular, see
#
# for a discussion of each configuration directive.
#
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# The configuration directives are grouped into three basic sections:
# 1. Directives that control the operation of the Apache server process as a
# whole (the 'global environment').
# 2. Directives that define the parameters of the 'main' or 'default' server,
# which responds to requests that aren't handled by a virtual host.
# These directives also provide default values for the settings
# of all virtual hosts.
# 3. Settings for virtual hosts, which allow Web requests to be sent to
# different IP addresses or hostnames and have them handled by the
# same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "/etc/httpd" will be interpreted by the
# server as "/etc/httpd/logs/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# Don't give away too much information about all the subcomponents
# we are running. Comment out this line if you don't mind remote sites
# finding out what major optional modules you are running
ServerTokens OS

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE! If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation
# (available at );
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/httpd"

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile run/httpd.pid

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 120

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so

#
# The following modules are not loaded by default:
#
#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule asis_module modules/mod_asis.so

#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf

#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
#ExtendedStatus On

#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
# . On HPUX you may not be able to use shared memory as nobody, and the
# suggested workaround is to create a user www and use that user.
# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
# when the value of (unsigned)Group is above 60000;
# don't use Group #-1 on these systems!
#
User apache
Group apache

### Section 2: 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# definition. These values also provide defaults for
# any containers you may define later in the file.
#
# All of these directives may appear inside containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin root@localhost

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
#ServerName www.example.com:80

#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client. When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#

Options FollowSymLinks
AllowOverride None

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
#

#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
UserDir disable

#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#
#UserDir public_html

#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
#
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# # Order allow,deny
# Allow from all
# # # Order deny,allow
# Deny from all
# #

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#

Order allow,deny
Deny from all

#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
#
TypesConfig /etc/mime.types

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#

# MIMEMagicFile /usr/share/magic.mime
MIMEMagicFile conf/magic

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

#
# EnableMMAP: Control whether memory-mapping is used to deliver
# files (assuming that the underlying OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. On some systems, turning it off (regardless of
# filesystem) can improve performance; for details, please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablemmap
#
#EnableMMAP off

#
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile
#
#EnableSendfile off

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error_log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# "combinedio" includes actual counts of actual bytes received (%I) and sent (%O); this
# requires the mod_logio module to be loaded.
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a
# container, they will be logged here. Contrariwise, if you *do*
# define per- access logfiles, transactions will be
# logged therein and *not* in this file.
#
#CustomLog logs/access_log common

#
# If you would like to have separate agent and referer logfiles, uncomment
# the following directives.
#
#CustomLog logs/referer_log referer
#CustomLog logs/agent_log agent

#
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
CustomLog logs/access_log combined

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature On

#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/var/www/icons/"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all

#
# WebDAV module configuration section.
#

# Location of the WebDAV lock database.
DAVLockDB /var/lib/dav/lockdb

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#

AllowOverride None
Options None
Order allow,deny
Allow from all

#
# Redirect allows you to tell clients about documents which used to exist in
# your server's namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
# Example:
# Redirect permanent /foo http://www.example.com/bar

#
# Directives controlling the display of server-generated directory listings.
#

#
# IndexOptions: Controls the appearance of server-generated directory
# listings.
#
IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable

#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions. These are only displayed for
# FancyIndexed directories.
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

#
# DefaultIcon is which icon to show for files which do not have an icon
# explicitly set.
#
DefaultIcon /icons/unknown.gif

#
# AddDescription allows you to place a short description after a file in
# server-generated indexes. These are only displayed for FancyIndexed
# directories.
# Format: AddDescription "description" filename
#
#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz

#
# ReadmeName is the name of the README file the server will look for by
# default, and append to directory listings.
#
# HeaderName is the name of a file which should be prepended to
# directory indexes.
ReadmeName README.html
HeaderName HEADER.html

#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing. Shell-style wildcarding is permitted.
#
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

#
# DefaultLanguage and AddLanguage allows you to specify the language of
# a document. You can then use content negotiation to give a browser a
# file in a language the user can understand.
#
# Specify a default language. This means that all data
# going out without a specific language tag (see below) will
# be marked with this one. You probably do NOT want to set
# this unless you are sure it is correct for all cases.
#
# * It is generally better to not mark a page as
# * being a certain language than marking it with the wrong
# * language!
#
# DefaultLanguage nl
#
# Note 1: The suffix does not have to be the same as the language
# keyword --- those with documents in Polish (whose net-standard
# language code is pl) may wish to use "AddLanguage pl .po" to
# avoid the ambiguity with the common suffix for perl scripts.
#
# Note 2: The example entries below illustrate that in some cases
# the two character 'Language' abbreviation is not identical to
# the two character 'Country' code for its country,
# E.g. 'Danmark/dk' versus 'Danish/da'.
#
# Note 3: In the case of 'ltz' we violate the RFC by using a three char
# specifier. There is 'work in progress' to fix this and get
# the reference data for rfc1766 cleaned up.
#
# Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)
# English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)
# Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)
# Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)
# Norwegian (no) - Polish (pl) - Portugese (pt)
# Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)
# Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)
#
AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw

#
# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
# Just list the languages in decreasing order of preference. We have
# more or less alphabetized them here. You probably want to change this.
#
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

#
# ForceLanguagePriority allows you to serve a result page rather than
# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
# [in case no accepted languages matched the available variants]
#
ForceLanguagePriority Prefer Fallback

#
# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default. To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
AddDefaultCharset Off

#
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#
#AddType application/x-tar .tgz

#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz

# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi

#
# For files that include their own HTTP headers:
#
#AddHandler send-as-is asis

#
# For type maps (negotiated resources):
# (This is enabled by default to allow the Apache "It Worked" page
# to be distributed in multiple languages.)
#
AddHandler type-map var

#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

#
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# Putting this all together, we can internationalize error responses.
#
# We use Alias to redirect any /error/HTTP_.html.var response to
# our collection of by-error message multi-language collections. We use
# includes to substitute the appropriate text.
#
# You can modify the messages' appearance without changing any of the
# default HTTP_.html.var files by adding the line:
#
# Alias /error/include/ "/your/include/path/"
#
# which allows you to create your own set of files by starting with the
# /var/www/error/include/ files and
# copying them to /your/include/path/, even on a per-VirtualHost basis.
#

Alias /error/ "/var/www/error/"

AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en es de fr
ForceLanguagePriority Prefer Fallback

# ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
# ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
# ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
# ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
# ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
# ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
# ErrorDocument 410 /error/HTTP_GONE.html.var
# ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
# ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
# ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
# ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
# ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
# ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
# ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
# ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
# ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
# ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

#
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash. This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Change the ".example.com" to match your domain to enable.
#
#
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .example.com
#

#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".example.com" to match your domain to enable.
#
#
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from .example.com
#

#
# Proxy Server directives. Uncomment the following lines to
# enable the proxy server:
#
#
#ProxyRequests On
#
# # Order deny,allow
# Deny from all
# Allow from .example.com
#

#
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#
#ProxyVia On

#
# To enable a cache of proxied content, uncomment the following lines.
# See http://httpd.apache.org/docs/2.2/mod/mod_cache.html for more details.
#
#
# CacheEnable disk /
# CacheRoot "/var/cache/mod_proxy"
#
#

#
# End of proxy directives.

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
#
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#

DocumentRoot /var/www/html
ServerName localhost

Include vhost.d/*.conf

apache 虚拟主机配置文件/etc/httpd/vhost.d/web_user_foobar.ini

<VirtualHost *:80>
SuexecUserGroup web_user_foobar web_user_foobar
DocumentRoot /var/www/virtual/web_user_foobar/home/wwwroot
ServerName web_user_foobar.w69-e0.ezwebtest.com
ServerAlias www.web_user_foobar.com web_user_foobar.com
DirectoryIndex index.html default.htm default.html index.htm default.asp index.asp index.php
ScriptAlias /php5-cgi /var/www/virtual/web_user_foobar/bin/php-cgi
<Directory /var/www/virtual/web_user_foobar/home/wwwroot>
AddHandler php5-cgi .php
Action php5-cgi /php5-cgi
AllowOverride All
Options -Indexes -ExecCGI Includes IncludesNOEXEC FollowSymLinks
Allow from all
</Directory>

ScriptAlias /cgi-bin/ /var/www/virtual/web_user_foobar/home/cgi-bin/
<Directory /var/www/virtual/web_user_foobar/home/cgi-bin/>
Options -Indexes ExecCGI
AllowOverride AuthConfig FileInfo
Allow from all
</Directory>

Alias /error /var/www/virtual/web_user_foobar/home/error
<Directory /var/www/virtual/web_user_foobar/home/error>
AllowOverride None
Options None
Allow from all
</Directory>
ErrorDocument 404 /error/404.html
ErrorDocument 403 /error/403.html
ErrorDocument 500 /error/500.html

CustomLog "|/usr/sbin/rotatelogs -l /var/www/virtual/web_user_foobar/home/logs/web_user_foobar-access_log.%Y.%m.%d 86400" common
ErrorLog "|/usr/sbin/rotatelogs -l /var/www/virtual/web_user_foobar/home/logs/web_user_foobar-error_log.%Y.%m.%d 86400"

CBandScoreboard /var/www/virtual/web_user_foobar/home/logs/bandscore
CBandExceededURL http://info.idccenter.net/err/exceeded.html
CBandLimit 10240Mi
CBandPeriod 30D
CBandSpeed 0 0 0
<Location /cband-stat>
SetHandler cband-status-me
</Location>
</VirtualHost>

nginx 1.2.0启用gzip http压缩手记

本站的web在vps上的nginx里跑,之前为简单其见,没有配置http gzip压缩支持,但vps有时网络抽风而速度很慢,于是想起来配置gzip压缩支持。

网上有很多nginx启用gzip压缩的文章,但还是上官方看文档是最权威准确的。这两个页面:

http://wiki.nginx.org/HttpGzipModule
http://wiki.nginx.org/NginxHttpGzipStaticModule

nginx官方文档很易懂,先给一个典型的配置实例,下面再详讲每条指令,感觉相当亲切。

查看ngix编译参考,是否启用了gzip模块,运行命令:

/path/to/binary/nginx -V
(我的nginx在PATH目录里,故命令中可以省略nginx所在的目录),写为nginx -t 即可,下文从略写

注意其中是否 --with-http_gzip_static_module,如果没有,那就自己编译一次吧,下面是我的配置参数,供参考。最后的--add-module=../nginx-lib/nginx-upload-progress-module-v0.9.0/是nginx上传进度模块,nginx第三方模块,源码放置在../nginx-lib/nginx-upload-progress-module-v0.9.0目录,如果你没有下载过该模块,去掉它就可以了。

nginx version: nginx/1.2.0
configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/conf/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --with-http_stub_status_module --with-http_gzip_static_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-http_random_index_module --with-cpu-opt=pentium4 --add-module=../nginx-lib/nginx-upload-progress-module-v0.9.0/

修改nginx配置文件,nginx配置文件目录参看nginx配置参数里的--conf-path。按我的配置,修改/usr/local/conf/nginx/nginx.conf,在http节点加入gzip配置即可。

    gzip_static on;
    gzip_http_version 1.1;
    gzip_proxied expired no-cache no-store private auth;
    gzip_disable "MSIE [1-6]\.";
    gzip_vary on;

    gzip on;
    gzip_min_length 1000;
    gzip_types text/plain application/xml text/css text/javascript text/xml;

测试配置是否有语法错误

nginx -t

输出消息

nginx: the configuration file /usr/local/conf/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/conf/nginx/nginx.conf test is successful

确认无误,重新加载nginx配置

nginx -s reload

检测gzip压缩是否正常工作,使用live http headers ——firefox的一款插件,看http头是是否有这样一行:Content-Encoding: gzip

也可以使用firefox的firebug插件 的“网络”功能看,或者使用第三方的在线检测工具,如http://tool.chinaz.com/Gzips/

Pages: Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 Next