antony:x:1234:1234:Antony Ho,,,:/home/antony:/bin/bash
antony:x:1234:1234:Antony Ho,,,:/home/newdirectory:/bin/bash
存檔。
這樣我的Home就被轉成/home/newdirectory了。
antony:x:1234:1234:Antony Ho,,,:/home/antony:/bin/bash
antony:x:1234:1234:Antony Ho,,,:/home/newdirectory:/bin/bash
DenyUsers someone #用戶名
DenyGroups some_people #群組
sudo /etc/init.d/ssh restart
sudo mkdir /home/www
sudo chown www-data /home/www
sudo chgrp www-data /home/www
為新的網站建立資料夾sudo mkdir /home/www/notes.antonyho.net
sudo mkdir /home/www/notes.antonyho.net/cgi-bin
sudo mkdir /home/www/notes.antonyho.net/logs
sudo mkdir /home/www/notes.antonyho.net/htdocs
sudo chown antony -R /home/www/notes.antonyho.net
sudo chgrp www-data -R /home/www/notes.antonyho.net
sudo touch /etc/apache2/sites-available/notes.antonyho.net
sudo cp /etc/apache2/sites-available/default
/etc/apache2/sites-available/notes.antonyho.net
sudo nano /etc/apache2/sites-available/notes.antonyho.net
<virtualhost>
ServerAdmin admin@notes.antonyho.net #網站負責人的電郵
ServerName notes.antonyho.net #網址
ServerAlias notes.antonyho.net #如果網站有縮寫網址可在這裡設定
DocumentRoot /home/www/notes.antonyho.net #改為你網站用的資料夾
<directory /home/www/notes.antonyho.net/ > #這裡記得在資料夾尾加/
Options Indexes FollowSymLinks MultiViews
#上面是設定資料夾的一些屬性
#Indexes,訪客可以要求資料夾的檔案清單,這個要小心設定使用與否。
AllowOverride None
Order allow,deny
allow from all
</directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ #設了這個就可以使用CGI
<directory>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</directory>
ErrorLog /home/www/notes.antonyho.net/logs/error.log #error log的位置
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined #access log的位置
Alias /htdocs/ "/home/www/notes.antonyho.net/htdocs/"
<directory>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</directory>
</virtualhost>
sudo a2ensite hkuoshard.com
sudo /etc/init.d/apache2 reload