「Linux ユーザホームページ作成」の版間の差分
ナビゲーションに移動
検索に移動
| 1行目: | 1行目: | ||
| − | ==Linux ユーザホームページ作成== | + | ==[[Linux ユーザホームページ作成]]== |
=====ユーザを作成し、公開ディレクトリを作成===== | =====ユーザを作成し、公開ディレクトリを作成===== | ||
| 10行目: | 10行目: | ||
cd /home/[username] | cd /home/[username] | ||
mkdir public_html | mkdir public_html | ||
| − | vi index.html | + | [[vi]] index.html |
chmod 644 index.html | chmod 644 index.html | ||
| 42行目: | 42行目: | ||
<Directory "/home/[username]/public_html"> | <Directory "/home/[username]/public_html"> | ||
AuthType Basic | AuthType Basic | ||
| − | AuthName " | + | AuthName "[[R]]estricted Files" |
AuthUserFile /home/[username]/shadow | AuthUserFile /home/[username]/shadow | ||
| − | + | [[R]]equire valid-user | |
| − | Options Indexes | + | Options Indexes Multi[[vi]]ews |
AllowOverride None | AllowOverride None | ||
Order allow,deny | Order allow,deny | ||
2020年2月16日 (日) 04:28時点における最新版
Linux ユーザホームページ作成
ユーザを作成し、公開ディレクトリを作成
- [username]にユーザ名を指定
useradd [username] passwd [password]
chmod -R 711 /home/[username] cd /home/[username] mkdir public_html vi index.html chmod 644 index.html
apache httpdの設定を変更
http://httpd.apache.org/docs/2.2/ja/mod/mod_userdir.html
<IfModule mod_userdir.c>
UserDir disable
UserDir enabled [username] [username2] ...
UserDir public_html <-- コメント解除
</IfModule>
↓コメント解除
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Options +ExecCGI <-- CGI使用時追加
AddHandler cgi-script .cgi .pl <-- CGI使用時追加
<Limit GET POST OPTIONS> Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
Basic認証
必要があればBasic認証を行う
- apache httpdの設定に追記
<Directory "/home/[username]/public_html">
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/[username]/shadow
Require valid-user
Options Indexes Multiviews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
- /etc/shadow ファイルを、/home/[username]/shadow にコピーしてくる。
- 許可するユーザの行を残し、他を削除し保存する
アクセス
http://[ホスト名]/~[username]
にてアクセスする。
© 2006 矢木浩人