網站流量統計 - Apache + awstats
作者:cross 日期:2006-11-11 15:24
[1.] apt-get install awstats-6.5-3.fc4
[2.] vi /etc/httpd/conf/httpd.conf
CustomLog logs/ssorc.tw-access_log combined
[3.] vi /etc/httpd/conf.d/awstats.conf
#
# Content of this file, with correct values, can be automatically added to
# your Apache server by using the AWStats configure.pl tool.
#
#
# Directives to add to your Apache conf file to allow use of AWStats as a CGI.
# Note that path "/usr/share/awstats/" must reflect your AWStats install path.
apache + proxy + squid + transparent
作者:cross 日期:2006-11-11 15:22
1. apt-get install squid
2. vi squid.conf
http_port 3128 # daemon 的 port
icp_prot 3130 # 被查詢封包觀察3130
cache_dir ufs /var/spool/squid 100 16 256
# <cache_dir> <aufs|ufs> <目錄所在> <MBytes大小> <dir1> <dir2>
# 這個暫存目錄下有 16 個目錄,而每個目錄中又有 256 個目錄
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
pid_filename /var/run/squid.pid
apache + htaccess
作者:cross 日期:2006-11-11 15:19
方式一
1. vi /etc/httpd/conf/httpd.conf
<Directory "/path/cross">
AuthName "Need Password"
AuthType Basic
AUthUserFile /path/htpasswd # 不需要與 /path/cross同一目錄
require valid-user
</Directory>
2. htpasswd -c /path/htpasswd cross
當新建htpasswd檔時,使用 -c 參數,建立第二位User時,不能再用"-c",否則會覆蓋
存帳號與密碼檔案為 htpasswd
使用者為 cross
Apache 模組 mod_ssl -- 讓網站的連線過程加密
作者:cross 日期:2006-11-04 16:55
安裝 httpd 與 mod_ssl 套件
設定 SSL 的地方
/etc/httpd/conf.d/ssl.conf
放 key 的地方,套件就已附 key 了
/etc/httpd/conf/ssl.*
非 SSL
echo "no SSL" > /var/www/html/index.html
vi /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName nossl.ssorc.tw
ErrorLog logs/nossl.ssorc.tw-error_log
CustomLog logs/nossl.ssorc.tw-access_log common
</VirtualHost>
建立要作 SSL 的目錄
mkdir /var/www/html/ssl
echo "SSL" > /var/www/html/ssl/index.html
自行編譯 php4
作者:cross 日期:2006-11-04 16:42
1.
apt-get install flex httpd-devel
2.
tar zxvf php-4.4.1.tar.gz
cd php-4.4.1
3.
./configure --with-apxs2=/usr/sbin/apxs --with-mysql --with-gd --with-zlib-dir --with-jpeg-dir --with-png-dir
make
make install
註:
'--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d'
4.
cp php.ini-dist /usr/local/lib/php.ini
apache 模組 mod_evasive -- 防 DOS攻擊
作者:cross 日期:2006-11-04 16:36
[1.] wget http://www.nuclearelephant.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz
[2.] tar zxvf mod_evasive_1.10.1.tar.gz
cd mod_evasive_1.10.1
[3.] $APACHE_ROOT/bin/apxs -i -a -c mod_evasive20.c
[4.] vi /etc/httpd/conf/httpd.conf
LoadModule evasive20_module modules/mod_evasive20.so
<IfModule mod_evasive20.c>
DOSHashTableSize 3097 # 記錄黑名單的尺寸
DOSPageCount 2 # 每個頁面被判斷為dos攻擊的讀取次數
DOSSiteCount 50 # 每個站點被判斷為dos攻擊的讀取部件(object)的個數
DOSPageInterval 1 # 讀取頁面間隔秒



