px與百分比表示對照表
10px => 77%
11px => 85%
12px => 93% (was 93)
13px => 100%
14px => 108% (was 107)
15px => 116% (was 114)
16px => 123.1% (was 122)
17px => 131% (was 129)
18px => 138.5% (was 136)
19px => 146.5% (was 144)
20px => 153.9% (was 152)
21px => 161.6% (was 159)
22px => 167%
23px => 174%
24px => 182%
25px => 189%
26px => 197%
px/13 = em
px/13.3333 = em ( for IE)
EX:set width 100px
.test {
width: 7.692em;
*width: 7.500em;
}
2010年8月31日
2010年8月21日
PHP取得目前檔案絕對目錄
EX: /var/www/include/abc.php
取得檔案名稱與路徑 /var/www/include/abc.php
__FILE__;
取得檔案名稱 test.php
basename(__FILE__);
取得檔案名稱(不含附檔名) test
basename(__FILE__, '.php');
取得此目錄前的完整路徑 /var/www/include
dirname(__FILE__);
取得上層目錄前的完整路徑 /var/www
dirname(dirname(__FILE__));
http://www.mydomain.com/page/to/my/index.php?par=1
$_SERVER['SERVER_PROTOCOL'].'://'. $_SERVER['HTTP_HOST']. $_SERVER['PHP_SELF'].'?'. $_SERVER['QUERY_STRING']
http://www.mydomain.com/page/to/my/index.php?par=1
$_SERVER['SERVER_PROTOCOL'].'://'. $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']
取得檔案名稱與路徑 /var/www/include/abc.php
__FILE__;
取得檔案名稱 test.php
basename(__FILE__);
取得檔案名稱(不含附檔名) test
basename(__FILE__, '.php');
取得此目錄前的完整路徑 /var/www/include
dirname(__FILE__);
取得上層目錄前的完整路徑 /var/www
dirname(dirname(__FILE__));
http://www.mydomain.com/page/to/my/index.php?par=1
$_SERVER['SERVER_PROTOCOL'].'://'. $_SERVER['HTTP_HOST']. $_SERVER['PHP_SELF'].'?'. $_SERVER['QUERY_STRING']
http://www.mydomain.com/page/to/my/index.php?par=1
$_SERVER['SERVER_PROTOCOL'].'://'. $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']
2010年8月10日
Awstat 流量統計
#apt-get install awstats
cd /etc/awstats/
cp awstats.conf awstats.w1.test..com.conf
cp awstats.conf awstats.w2.test..com.conf
修改內容
#vi awstats.w1.test.com.conf
...
LogFile="/var/log/apache2/access.log"
LogFormat=1
SiteDomain="w1.test.com"
DNSLookup=0
DirCgi="/awstats"
#vi /etc/apache2/site-available/test.com
NameVirtualHost 192.168.1.6:80/usr/lib/cgi-bin/awstats.pl -config=aaa.ns2go.com -update
DocumentRoot /var/www
ServerName 192.168.1.6
ServerAdmin w1@test.com
# ErrorLog logs/test.com-error_log
# CustomLog logs/test.com-access_log common
DocumentRoot /var/www/w1
ServerName w1.test.com
ServerAdmin w1@test.com
CustomLog "/var/log/apache2/w1.test.com.log" combined
Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon/ "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css
ScriptAlias /awstats/ /usr/lib/cgi-bin/
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Options None
AllowOverride None
Order allow,deny
Allow from All
更新記錄
#/usr/lib/cgi-bin/awstats.pl -config=w1.test.com -update
查看記錄網址
http://aaa.ns2go.com/awstats/awstats.pl?config=w1.test.com
定期執行
vi /etc/crontab
*/5 * * * * root /usr/lib/cgi-bin/awstats.pl -config=w1.test.com -update
cd /etc/awstats/
cp awstats.conf awstats.w1.test..com.conf
cp awstats.conf awstats.w2.test..com.conf
修改內容
#vi awstats.w1.test.com.conf
...
LogFile="/var/log/apache2/access.log"
LogFormat=1
SiteDomain="w1.test.com"
DNSLookup=0
DirCgi="/awstats"
#vi /etc/apache2/site-available/test.com
NameVirtualHost 192.168.1.6:80/usr/lib/cgi-bin/awstats.pl -config=aaa.ns2go.com -update
DocumentRoot /var/www
ServerName 192.168.1.6
ServerAdmin w1@test.com
# ErrorLog logs/test.com-error_log
# CustomLog logs/test.com-access_log common
DocumentRoot /var/www/w1
ServerName w1.test.com
ServerAdmin w1@test.com
CustomLog "/var/log/apache2/w1.test.com.log" combined
Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon/ "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css
ScriptAlias /awstats/ /usr/lib/cgi-bin/
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Options None
AllowOverride None
Order allow,deny
Allow from All
更新記錄
#/usr/lib/cgi-bin/awstats.pl -config=w1.test.com -update
查看記錄網址
http://aaa.ns2go.com/awstats/awstats.pl?config=w1.test.com
定期執行
vi /etc/crontab
*/5 * * * * root /usr/lib/cgi-bin/awstats.pl -config=w1.test.com -update
2010年8月4日
Apache 流量限制
安裝 libapache2-mod-bw
apt-get install libapache2-mod-bw
啟用bw模組
a2enmod bw
在虛擬網站設定加入參數
[VirtualHost w1.test.com:80]
bahlah...
bahlah...
BandWidthModule On
ForceBandWidthModule On
Bandwidth all 10240
bahlah...
bahlah...
[/VirtualHost]
存檔後重新啟動apache即可.
==================================================
可調整參數有
BandWidthModule [On|Off]
ForceBandWidthModule [On|Off]
BandWidth [from] [bytes/s]
MinBandWidth [from] [bytes/s]
[from]可以是localhost,192.168.1.0/24,all
[bytes/s]就是速度
LargeFileLimit [type][min size][bytes/s]
大檔限制,檔案超過[min size]就把速度限在[bytes/s]
BandWidthPacket [size]
一般不作調整
BandWidthError [error]
MaxConnection [from][max]
限制最大連線數
apt-get install libapache2-mod-bw
啟用bw模組
a2enmod bw
在虛擬網站設定加入參數
[VirtualHost w1.test.com:80]
bahlah...
bahlah...
BandWidthModule On
ForceBandWidthModule On
Bandwidth all 10240
bahlah...
bahlah...
[/VirtualHost]
存檔後重新啟動apache即可.
==================================================
可調整參數有
BandWidthModule [On|Off]
ForceBandWidthModule [On|Off]
BandWidth [from] [bytes/s]
MinBandWidth [from] [bytes/s]
[from]可以是localhost,192.168.1.0/24,all
[bytes/s]就是速度
LargeFileLimit [type][min size][bytes/s]
大檔限制,檔案超過[min size]就把速度限在[bytes/s]
BandWidthPacket [size]
一般不作調整
BandWidthError [error]
MaxConnection [from][max]
限制最大連線數
Apache 虛擬網站架設
目的在同一主機上使用一個IP架設多個網站
首要條件就是dns要設定正解至虛擬主機IP
test.com dns設定
dns IN A 123.123.123.123
w1 IN CNAME dns
w2 IN CNAME dns
在/etc//apache2/sites-available/ 建立 test.com 檔並編輯
<VirtualHost *:80>
DocumentRoot /var/www
ServerName 192.168.1.6
ServerAdmin w1@test.com
ErrorLog logs/w1.test.com-error_log
CustomLog logs/w1.test.com-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/w1
ServerName w1.test.com
ServerAdmin w1@test.com
ErrorLog logs/w1.test.com-error_log
CustomLog logs/w1.test.com-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/w2
ServerName w2.test.com
ServerAdmin w2@test.com
ErrorLog logs/w2.test.com-error_log
CustomLog logs/w2.test.com-access_log common
</VirtualHost>
存檔後,執行a2ensite
root@public:/etc/apache2/sites-available# a2ensite
Your choices are: default default-ssl test.com
Which site(s) do you want to enable (wildcards ok)?
輸入test.com
接著重新啟重apache
在網址列輸入w1.test.com 與 w2.test.com就會各別連至不同的網站了.
首要條件就是dns要設定正解至虛擬主機IP
test.com dns設定
dns IN A 123.123.123.123
w1 IN CNAME dns
w2 IN CNAME dns
在/etc//apache2/sites-available/ 建立 test.com 檔並編輯
<VirtualHost *:80>
DocumentRoot /var/www
ServerName 192.168.1.6
ServerAdmin w1@test.com
ErrorLog logs/w1.test.com-error_log
CustomLog logs/w1.test.com-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/w1
ServerName w1.test.com
ServerAdmin w1@test.com
ErrorLog logs/w1.test.com-error_log
CustomLog logs/w1.test.com-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/w2
ServerName w2.test.com
ServerAdmin w2@test.com
ErrorLog logs/w2.test.com-error_log
CustomLog logs/w2.test.com-access_log common
</VirtualHost>
存檔後,執行a2ensite
root@public:/etc/apache2/sites-available# a2ensite
Your choices are: default default-ssl test.com
Which site(s) do you want to enable (wildcards ok)?
輸入test.com
接著重新啟重apache
在網址列輸入w1.test.com 與 w2.test.com就會各別連至不同的網站了.
訂閱:
文章 (Atom)