啟動 mod_userdir 動態模組
$ sudo a2enmod userdir
Enabling module userdir.
Run '/etc/init.d/apache2 restart' to activate new configuration!
修改 /etc/apache2/httpd.conf 設定檔內容
$ sudo nano /etc/apache2/httpd.conf
加入這段
==================
# Settings for user home directories
#
# Required module: mod_userdir (a2enmod 命令啟動)
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received. Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir kmdepot
<Directory /home/*/kmdepot>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
==================
UserDir kmdepot (使用者家目錄下創造的名稱,wwwroot的意思)
<Directory /home/*/kmdepot>
讓新增的使用者預設建立網站資料夾
在/etc/skel/下創造kmdepot這個資料夾
手動在目前的使用者家目錄建立網站資料夾
$ cd ~
$ mkdir kmdepot
$ chmod 755 kmdepot
$ echo "Test your home" > kmdepot/index.html
預設的http位址(前面有~)
http://你的主機名稱/~cloudwalker/
如果想去除~改成像下面這樣
http://你的主機名稱/cloudwalker/
方法
$ cd /var/www
#在網站根目錄建立一個連結檔為使用者帳號名稱 連結到該使用者的網站目錄
$ sudo ln -s /home/cloudwalker/kmdepot cloudwalker
網站目錄
index.html是首頁檔
沒有留言:
張貼留言