http://bash.cyberciti.biz/backup/mysql-backup.bash.php
#!/bin/bash
# Shell script to backup MySql database
# To backup Nysql databases file to /backup dir and later pick up by your
# script. You can skip few databases from backup too.
# For more info please see (Installation info):
# http://www.cyberciti.biz/nixcraft/vivek/blogger/2005/01/mysql-backup-script.html
# Last updated: Aug - 2005
# --------------------------------------------------------------------
# This is a free shell script under GNU GPL version 2.0 or above
# Copyright (C) 2004, 2005 nixCraft project
# Feedback/comment/suggestions : http://cyberciti.biz/fb/
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------MyUSER="SET-MYSQL-USER-NAME" # USERNAME
MyPASS="SET-PASSWORD" # PASSWORD
MyHOST="localhost" # Hostname# Linux bin paths, change this if it can't be autodetected via which command
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
CHOWN="$(which chown)"
CHMOD="$(which chmod)"
GZIP="$(which gzip)"# Backup Dest directory, change this if you have someother location
DEST="/backup"# Main directory where backup will be stored
MBD="$DEST/mysql"# Get hostname
HOST="$(hostname)"# Get data in dd-mm-yyyy format
NOW="$(date +"%d-%m-%Y")"# File to store current backup file
FILE=""
# Store list of databases
DBS=""# DO NOT BACKUP these databases
IGGY="test"[ ! -d $MBD ] && mkdir -p $MBD || :
# Only root can access it!
$CHOWN 0.0 -R $DEST
$CHMOD 0600 $DEST# Get all database list first
DBS="$($MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -Bse 'show databases')"for db in $DBS
do
skipdb=-1
if [ "$IGGY" != "" ];
then
for i in $IGGY
do
[ "$db" == "$i" ] && skipdb=1 || :
done
fiif [ "$skipdb" == "-1" ] ; then
FILE="$MBD/$db.$HOST.$NOW.gz"
# do all inone job in pipe,
# connect to mysql using mysqldump for select mysql database
# and pipe it out to gz file in backup dir :)
$MYSQLDUMP -u $MyUSER -h $MyHOST -p$MyPASS $db | $GZIP -9 > $FILE
fi
done
#!/bin/sh
today=`date "+%Y-%m-%d"`
olddate=`date -d "-10 day" "+%Y-%m-%d"`
cd /backup/
tar -zcvf www.$today.tar.gz /var/www
service mysql stop
tar -zcvf mysql.$today.tar.gz /var/lib/mysql
service mysql start
rm -rf www.$olddate.tar.gz
rm -rf mysql.$olddate.tar.gz
ServerTokens OS ← 找到這一行,將“OS”改為“Prod”(在出現錯誤頁的時候不顯示服務器操作繫統的名稱)
↓
ServerTokens Prod ← 變為此狀態
(閱讀全文)
http://httpd.apache.org/docs/2.2/mod/core.html#servertokens
This directive controls whether Server
response
header field which is sent back to clients includes a
description of the generic OS-type of the server as well as
information about compiled-in modules.
ServerTokens Prod[uctOnly]
- Server sends (e.g.):
Server: Apache
ServerTokens Major
- Server sends (e.g.):
Server: Apache/2
ServerTokens Minor
- Server sends (e.g.):
Server: Apache/2.0
ServerTokens Min[imal]
- Server sends (e.g.):
Server: Apache/2.0.41
ServerTokens OS
- Server sends (e.g.):
Server: Apache/2.0.41 (Unix)
ServerTokens Full
(or not specified)- Server sends (e.g.):
Server: Apache/2.0.41 (Unix) PHP/4.2.2 MyMod/1.2
This setting applies to the entire server, and cannot be enabled or disabled on a virtualhost-by-virtualhost basis.
After version 2.0.44, this directive also controls the
information presented by the ServerSignature
directive.
http://blog.miniasp.com/post/2008/04/How-to-install-PHP4-on-Ubuntu-804-LTS.aspx
據我所知 Ubuntu Linux 大概從 6.06 (Dapper) 開始就不支援 PHP4 了,且 PHP 官方網站也宣布從 2007-12-31 起停止了 PHP4 的計畫(也就是以後也不會再出新版),不過我想應該還是有不少網站是用 PHP4 寫的,要讓這些網站在短時間內全部升級改寫成 PHP5 的版本還真不太容易。今天我也把 Ubuntu 8.04 LTS 裝起來了,並嘗試著也將 php4 裝起來,以下是在 Ubuntu 8.04 成功安裝 php4 的心得分享(當然這個方法在 Ubuntu 6.06, 6.10 或 7.10 一樣適用)。
1. 建立一個檔案到 /etc/apt/sources.list.d/ 目錄下:
# vi /etc/apt/sources.list.d/dapper.sources.list
檔案內容僅需要輸入一行即可:
deb http://tw.archive.ubuntu.com/ubuntu/ dapper universe main restricted multiverse
2. 執行 apt-get update 指令更新 Packages 資料庫
你可以發現最後面取得的時 dapper/universe 套件,這裡面就有包括 php4 的所有相關套件。
3. 搜尋所有 php4 相關的套件
root@ubuntu804:~# apt-cache search php4
4. 安裝 php4-cli
root@ubuntu804:~# apt-get install php4-cli
5. 大功告成!我們來測試一下 php4 是否可以正常執行:
root@ubuntu804:~# php4 -v PHP Warning: mime_magic: type search/400 \\input text/x-tex invalid in Unknown on line 0 PHP Warning: mime_magic: type search/400 \\section text/x-tex invalid in Unknown on line 0 PHP Warning: mime_magic: type search/400 \\setlength text/x-tex invalid in Unknown on line 0 PHP Warning: mime_magic: type search/400 \\documentstyle text/x-tex invalid in Unknown on line 0 PHP Warning: mime_magic: type search/400 \\chapter text/x-tex invalid in Unknown on line 0 PHP Warning: mime_magic: type search/400 \\documentclass text/x-tex invalid in Unknown on line 0 PHP Warning: mime_magic: type regex [Cc]onstant[[:space:]]+[Ss]tory text/x-inform invalid in Unknown on line 0 PHP 4.4.2-1build1 (cli) (built: Apr 6 2006 09:44:32) Copyright (c) 1997-2006 The PHP Group
你可以發現執行的過程會出現一堆 PHP Warning 的警告訊息,這是因為 Ubuntu 8.04 中預設的 /usr/share/file/magic.mime (MIME 定義檔) 檔案中有幾行 php4 認不得,而導致出現警示訊息,不過這幾行並不會影響 PHP 的運作。
因為在 magic.mime 中的這 7 行是用來定義 TeX documents 與 Inform interactive fiction language 的檔案類型,因為很少用到,所以我覺得將這幾行註解掉應該沒關係!所以我們還是修改一下 magic.mime 檔案,將這幾行「太新」的 MIME 定義給註解掉,讓 php4 不會出現警告訊息。你開啟 /usr/share/file/magic.mime 檔案後直接跳到第598行:
# TeX documents, from Daniel Quinlan (quinlan@yggdrasil.com)
0 search/400 \\input text/x-tex
0 search/400 \\section text/x-tex
0 search/400 \\setlength text/x-tex
0 search/400 \\documentstyle text/x-tex
0 search/400 \\chapter text/x-tex
0 search/400 \\documentclass text/x-tex
# Type: Inform interactive fiction language # URL: http://www.inform-fiction.org/ # From: Reuben Thomas <rrt@sc3d.org> 0 regex [Cc]onstant[[:space:]]+[Ss]tory text/x-inform
這要將這幾行最前面加上井字號 ( # ) 後存檔,然後我們在測試一下 php4 是否正常執行
root@ubuntu804:~# php -v PHP 4.4.2-1build1 (cli) (built: Apr 6 2006 09:44:32) Copyright (c) 1997-2006 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
LAMP與Moodle教學平台建置
推薦瀏覽軟體:Mozilla Firefox + Auto Copy 擴充套件
參考資料來源:
http://apt.nc.hcc.edu.tw/web/student_server_FC5/student_server_FC5.html
學生用伺服器建置流程(Fedora Core 5 版)
相關網路資料
IP:192.168.0.201~235(依座位而定)
FQDN:test.ttcps.tpc.edu.tw
Domain:ttcps.tpc.edu.tw
DNS Server:163.20.118.5(for 土城國小)
子網路遮罩(netmask):255.255.255.0
閘道器(gateway):192.168.0.254
Fedora Core 5 ISO 檔下載
Fedora 官方網站:http://fedora.redhat.com/
CD版本(共五片)
ftp://apt.nc.hcc.edu.tw/pub/fedora/linux/core/5/i386/iso/FC-5-i386-disc2.iso
ftp://apt.nc.hcc.edu.tw/pub/fedora/linux/core/5/i386/iso/FC-5-i386-disc3.iso
ftp://apt.nc.hcc.edu.tw/pub/fedora/linux/core/5/i386/iso/FC-5-i386-disc4.iso
ftp://apt.nc.hcc.edu.tw/pub/fedora/linux/core/5/i386/iso/FC-5-i386-disc5.iso
DVD版本(共一片)
透過 BitTorrent 下載:
http://torrent.fedoraproject.org/
sha1sum 檢查碼:ftp://apt.nc.hcc.edu.tw/pub/fedora/linux/core/5/i386/iso/SHA1SUM
sha1sum for windows:http://apt.nc.hcc.edu.tw/pub/mirror/sha1sum.exe
Moodle網站檔案的結構:
config.php - 包含各種基本設定。這檔案不是隨著 Moodle而來 - 您需要在安裝過程建立它。
install.php - 您將用來建立 config.php 的腳本
version.php - 定義當前 Moodle 程式碼的版本
index.php - 這網站的首頁
* admin/ - 管理這整個伺服器的程式碼
* auth/ - 用於認證用戶的插件模組
* blocks/ - 用於管理在許多頁面上的小區塊的插件模組
* calendar/ - 管理和顯示行事曆的程式碼
* course/ - 顯示和管理課程的程式碼
* doc/ - Moodle用的幫助文件 (例如這一頁)
* files/ - 顯示和管理上傳檔案的程式碼
* lang/ - 不同語言的文字檔,每種語言一個目錄
* lib/ - Moodle核心程式碼的程式庫
* login/ - 處理登入和產生帳號的程式碼
* mod/ - 所有 Moodle主要的課程模組都放在這裡
* pix/ - 產生網站的圖表
* theme/ - 主題包/用以改變網站外觀的外殼
* user/ - 顯現和管理用戶的程式碼
轉貼自 http://redhat.ecenter.idv.tw/bbs/showthread.php?threadid=56973
一般BSD家族預設安裝完成後,Sendmail便已安裝完成,我們今天就來架設Mail Server,
我們需要的功能是透過SASL驗證來寄發信件,並利用SpamAssassin + Procmail來過濾垃圾郵件,
如此功能足以應付一般中小企業的需求了!
自由軟體技術支援中心 提供server tip
something about sercurity