Category Archives: Apache

[Linux笔记]apache 2.4 安装 mod_rpaf

Leave a comment

在使用第三方的DANginx插件用在Directadmin apache2.4的时候,发现无法安装mod_rpaf.这个插件是用来让apache获取到访客正确ip的。
apache2.4已经有了mod_remoteip.so 但没时间仔细研究,Directadmin无法正常加载,先行编译mod_rpaf达到要求
编译时提示的错误

# apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
/var/www/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic   -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/include/apache  -I/usr/include/apache   -I/usr/include/apache   -c -o mod_rpaf-2.0.lo mod_rpaf-2.0.c && touch mod_rpaf-2.0.slo
mod_rpaf-2.0.c: In function 'rpaf_cleanup':
mod_rpaf-2.0.c:150: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c:151: error: 'conn_rec' has no member named 'remote_addr'
mod_rpaf-2.0.c:151: warning: implicit declaration of function 'inet_addr'
mod_rpaf-2.0.c:151: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c: In function 'change_remote_ip':
mod_rpaf-2.0.c:164: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c:183: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c:186: error: 'conn_rec' has no member named 'remote_ip'
mod_rpaf-2.0.c:187: error: 'conn_rec' has no member named 'remote_addr'
mod_rpaf-2.0.c:187: error: 'conn_rec' has no member named 'remote_ip'
apxs:Error: Command failed with rc=65536

Continue reading

[Linux笔记]DirectAdmin添加mod_pagespeed加速Apache

Leave a comment

mod_pagespeed是一个apache的加速模块,他是由谷歌公司免费提供的傻瓜式网站优化工具,这个加速模块可以自行对网络传输的html字节及图像,以及css压缩等优化,据称该模块最大可以将网页加载速度提高50%,而且它拥有智能缓存系统,最大限度减少了配置上的麻烦。

一、获得模块

wget http://soft.kwx.gd/module/mod-pagespeed-beta_current_i386.rpm #32位
wget http://soft.kwx.gd/module/mod-pagespeed-beta_current_x86_64.rpm #64位

二、执行安装

rpm -i --nodeps mod-pagespeed-beta_current_*.rpm 

SSH执行以上命令,安装该模块,提示“package mod-pagespeed-beta-0.10.22.4-1633.i386 is already installed”则表示安装成功。

Continue reading

[Linux笔记] Apache .htaccess 定义时区

Leave a comment

现在大6河蟹如火如荼,童鞋们都积极学习穿越技能攻打罪恶的资本主义。但是使用外国空间,存在时差,会影响到我们不少程序的正常使用。

现在我告诉大家一个一劳永逸的方法,就是在万能的.htaccess中定义时区即可!

步骤如下:
1、下载网站根目录中的.htaccess,在里面的添加保存如下内容:

SetEnv TZ Asia/Chongqing

2、把更改好的.htaccess上传至空间,再刷新一下。这下子应该和你当前区域的时间一样了。 Continue reading

[Linux笔记] Apache 常用优化 .htaccess 规则

2 Comments

DEFLATE压缩html|css|xml|js等网页文件:

AddOutputFilterByType DEFLATE text/plain  
AddOutputFilterByType DEFLATE text/html  
AddOutputFilterByType DEFLATE text/xml  
AddOutputFilterByType DEFLATE text/css  
AddOutputFilterByType DEFLATE application/xml  
AddOutputFilterByType DEFLATE application/xhtml+xml  
AddOutputFilterByType DEFLATE application/rss+xml  
AddOutputFilterByType DEFLATE application/javascript  
AddOutputFilterByType DEFLATE application/x-javascript

Continue reading

[Linux笔记] Apache 通过.htaccess实现简单反向代理

25 Comments

通常做站的盆友们手上也有不少虚拟主机,特别是外国的LAMP类型主机。有不少空间小的500M、1G的空闲在手上做大站也不成,小站也不想做多怎么办?

放在手里浪费着也是浪费着,今天我就告诉大家一个利用方案。利用闲置的Apache主机,通过.htaccess实现简单反向代理。弥补某些主机、或建站系统不能绑定域名的遗憾,多台快速的虚拟主机给稍慢的站点加速、轮询、智能解析[CDN]等等效果。

规则如下:

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ http://www.baidu.com/$1 [P]

Continue reading