本blog使用的服務器是AWS EC2,選用節(jié)點位于日本,所以訪問速度只能說湊合。前段時間把網(wǎng)站上的css、js以及圖片等靜態(tài)資源放在又拍云存儲上,訪問速度明顯提高不少。由于網(wǎng)站沒有備案,所以不能使用自己的域名來直接訪問又拍云存儲上的內(nèi)容,只能通過又拍云存儲的三級域名來訪問。
#!/bin/bash
HOST="v0.ftp.upyun.com"
USER="Your FTP Username"
PASS="Your FTP Password"
LCD="Your Website Root Dir"
RCD="/"
lftp -c "open ftp://v0.ftp.upyun.com
user $USER $PASS;
lcd $LCD;
cd $RCD;
mirror --reverse --delete --dereference --verbose \
--exclude-glob=*.php \
--exclude-glob=*.txt \
--exclude-glob=*.xml \
--exclude-glob=*.htm \
--exclude-glob=*.html \
--exclude-glob=*.gz \
--exclude-glob=*.psd \
--exclude-glob=*.mo \
--exclude-glob=*.po \
--exclude-glob=*.pot \
--exclude-glob=arthemia/ \
--exclude-glob=ad/ \
--exclude-glob=report/ \
--verbose
"
上述腳本需要根據(jù)自己的實際情況修改,比如用戶名、密碼以及網(wǎng)站的根目錄。注意:參數(shù)“-c”后面的引號對應的是最后面的那個引號,exclude-glob排除文件,讓其不同步到又拍云上,可以是具體的文件或者目錄。