NICA

【20100519】因有了NexusOne而擁有了全世界的卡恩萬丟洗襪

Browsing Posts in Privacy

待補:進階設定/刪除 default 設定
(alter awstats.module.conf)
add new /etc/awstats/awstats.$url.conf file:

51,52c51
< LogFile=”/var/log/httpd/mylog.log”
<

> LogFile=”/var/log/httpd/$url-access_log”
122c121
< LogFormat=1

> LogFormat=4
153c152
< SiteDomain=”"

> SiteDomain=”$url
168c167
< HostAliases=”localhost 127.0.0.1 REGEX[myserver\.com$]”

> HostAliases=”$url
239c238
< AllowToUpdateStatsFromBrowser=0

> AllowToUpdateStatsFromBrowser=1
891c890,891
< Lang=”auto”

> #Lang=”auto”
> Lang=”tw

3. Setup Crond to run awstats_updateall.pl every hours. (day?)

Speed up Apache 2.0 web access or downloads with mod_deflate
Posted by nixcraft

You can speed up downloads or web page access time with Apache mod_deflate module. The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.

This decreases the amount of time and data transmitted over the network, resulting in faster web experience or downloads for visitors.

Make sure mod_deflate included with your Apache server (by default it is now installed with all modern distro).
Configuration

Open httpd.conf file:

# vi httpd.conf

Append following line:

LoadModule deflate_module modules/mod_deflate.so

Append following configuration <Location /> directive:

<Location />
AddOutputFilterByType DEFLATE text/html text/plain text/xml
….

<Location>

Above line only compress html and xml files. Here is the configuration from one of my production box:

<Location />


AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
AddOutputFilterByType DEFLATE text/html


<Location>

Save the file and restart apache web server. All of the above extension file should compressed by mod_deflate.

# /etc/init.d/httpd restart

You can also specify specific directory and enabling compression only for the html files. For example /static/help/ directory:

<Directory “/static/help”>
AddOutputFilterByType DEFLATE text/html
</Directory>

In real life, there are issues with compressing other types of files such as mp3 or images. If you don’t want to compress images or mp3 files then add following to your configuration:

SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.avi$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mov$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mp3$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mp4$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.rm$ no-gzip dont-vary
See also:

* mod_deflate home page

原文出處:
http://www.cyberciti.biz/tips/speed-up-apache-20-web-access-or-downloads-with-mod_deflate.html

Powered by WordPress Web Design by SRS Solutions © 2010 NICA Design by SRS Solutions