在linux中,可以用apache 和 wu-ftpd 伺服器通過一些簡單設定,實現個人空間服務,apache是web伺服器,ftp提供首頁上傳功能.本文以redhat 7.2 linux為例,假設apache 和 wu-ftpd伺服器已經安裝,具體配置方法如下:
(1)安裝redhat7.2 linux時選擇"伺服器"或者定製安裝伺服器軟體;
(2)修改/etc/httpd/conf/httpd.conf檔案中下面關於個人空間設定的一段.(//後是詳細說明)
UserDir public_html //此處修改預設目錄,可修改,應該與下面的
//相對應
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
# //
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#
# Order allow,deny
# Allow from all
#
#
# Order deny,allow
# Deny from all
#
# //.....行之間的所有#去掉,使得個人首頁使用者的設定生效.並且""中的 "/home/*/public_html"是個人首頁服務在linux中存放位置的設定 *代表使用者名稱產生的目錄名.
重新啟動httpd服務:httpd stop / httpd start 或者httpd restart
(3) 添加一個ftp使用者的shell,使其不能使用命令,和telnet 和ssh服務
編輯/etc/shells檔案,在檔案最後添加一行"/dev/null"的內容
(4)添加一個ftpchroot族,改組中的使用者將已自己的home目錄作為ftp根目錄
groupadd ftpchroot
(5)使用者申請個人首頁空間時,所用的使用者名稱在linux上要作為ftpchroot組的使用者.以下操作以test使用者為例:
建立一個使用者test ;密碼:test
usradd test -s /dev/null -g ftpchroot
passwd test
這樣就在/home目錄下自動產生一個test的目錄.
(6)進入test目錄,建立個人首頁發布目錄public_html,然後進行使用權限設定
cd /home/test
mkdir public_html
chmod 711 /home/test
chmod 755 /home/test/public_html
ok,現在只要將網頁檔案通過用使用者名稱test密碼為test,使用ftp上傳到自己ftp目錄下的public_html目錄就可以啟動自己的web服務了,系統預設為index.html檔案.
後記:如果伺服器系統安裝完整,在個人首頁中可以支援php jsp動態網頁和mysql postgresql資料庫.