在WAMP环境启用GZIP
开启gzip实际上非常容易,但是我发现大多数已存的建议都是错的. 下面说明我这里是如何实现的: 1,开启Apache的 deflate_module 和 headers_module.(译者注:这里采用了译者实际实现的方式.) 去掉 #LoadModule headers_module modules/mod_headers.so 前面的注释# 去掉 #LoadModule deflate_module modules/mod_deflate.so 前面的注释# #上面两段如果配置文件中没有就自己加上. 2,编辑httpd.conf,在文件末尾,include文件之前加入如下片段(注意ifmodule标签之间的文字是一行,不要打断): AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x- javascript application/javascript 3, 重启服务. service httpd restart
fedora的/etc/modules.conf 位置
fc3使用2.6的内核,模块配置文件改为: /etc/modprobe.conf
限制CPU使用率的方法
1,apache本身的限制功能(RLimitCPU) 引用国外这个帖子: The PHP test can be used to show that the problem is evident, but it is not conclusive to prove that there is no limit put in place. The reason is that it depends on how PHP is configured on the server. If the PHP scripting engine is setup as a CGI application which is forked by Apache, then the RLimit* operatives will apply and the PHP script can prove this. If they run within httpd however, the limits would not apply to the PHP engine. 这个限制将施于Apache子服务请求衍生出的进程,而不是Apache子进程本身.这个范围包括CGI脚本和SSI执行命令,但不包括所有从Apache父进程衍生出的进程.比如说管道日志. 如果不子进程不衍生进程,或非常占资源的这个进程不属于衍生出来的进程,那不就是没办法了吗?所以呀,这个办法不行地. 2,通过系统的ulimit命令限制资源的使用设置文件在: /etc/security/limits.conf 比如: xok_la hard cpu 1 xok_la hard fsize 50000 xok_la hard memlock 1000 xok_la hard nofile 50 xok_la hard ...
Linux安装Xcache缓存器
由于国内网站备案比较麻烦,所以笔者便把网站放到了美国.虽然网站免去了备案的困扰,但是从访问速度上来看,一般要比放于国内的网站慢2-3倍,所以便想办法对网站做了一些简单的优化,比如使用缓存系统来提升网站页面访问速度. 目前用于Web的缓存系统很多,包括squid、varnish、Nginx自带的proxy_cache、FastCGI中的fastcgi_cache、APC、Xcache等. 像squid、varnish、Nginx自带的proxy_cache这类系统,属于重量级产品,配置维护比较麻烦,不适合小型网站,而且一般用这类系统缓存静态内容,比如图片、css、JavaScript等;像FastCGI中的fastcgi_cache,它主要用于缓存动态内容,所以在访问使用fastcgi_cache的网站时速度极快,但是笔者使用时发现其维护比较麻烦,特别是每次网站有数据要更新后,如果不等到缓冲期过期后得需要手动清除缓存才能看到网站更新的内容; 至于APC个人感觉性能就一般了,拿它和Xcache比较时发现访问使用Xcache网站的速度明显高于使用APC网站的速度(笔者没有具体测试),所以最终选择了使用Xcache. 我们都知道PHP是一种动态语言,它在执行时是以解释的方式执行,所以 PHP代码每次执行时都会被解析和转换成操作码(opcode).而Xcache是一个开源的操作码缓存器/优化器,它通过把解析/转换PHP后的操作码缓存到文件(直到原始代码被修改)从而避免重复的解析过程,提高了代码的执行速度,通常能够提高页面生成速率2-5倍,降低了服务器负载,提高了用户访问网站的速度. 一、安装Xcache $ wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz $ tar zxvf xcache-1.3.0.tar.gz $ cd xcache-1.3.0 $ /usr/local/php/bin/phpize $ ./configure --enable-xcache $ make...
Curl development headers with SSL...
I'm trying to install phusion passenger nginx module, but it fails: Curl development headers with SSL support... not found I solved this problem by installing: yum install zlib-devel e2fsprogs-devel krb5-devel
The file is absent or does not have...
运行: $ ./startup.sh 提示: Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program. 说明catalina.sh没有执行权限.把 ~/apache-tomcat-6.0.33/bin/目录下的所有sh文件的权限都设为755(当然 也包括catalina.sh)即可: $ chmod 755 *.sh 再次运行startup.sh,显示的结果正常: $ ./startup.sh Using CATALINA_BASE: /root/apache-tomcat-6.0.33 Using CATALINA_HOME: /root/apache-tomcat-6.0.33 Using CATALINA_TMPDIR: /root/apache-tomcat-6.0.33/temp Using JRE_HOME: /usr Using CLASSPATH: /root/apache-tomcat-6.0.33/bin/bootstrap.jar