【1】 Apacheの設定ファイル「userdir.conf」を修正する
sudo vi /etc/httpd/conf.d/userdir.conf ~~~~~~~~~~~~~~~~~~~~~~~ <IfModule mod_userdir.c> # # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # #UserDir disabled UserDir enabled # # To enable requests to /~user/ to serve the user's public_html # directory, remove the "UserDir disabled" line above, and uncomment # the following line instead: # UserDir public_html </IfModule> <Directory "/home/*/public_html"> #AllowOverride FileInfo AuthConfig Limit Indexes #Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec AllowOverride All Options IncludesNoExec ExecCGI FollowSymLinks Require method GET POST OPTIONS </Directory> ~~~~~~~~~~~~~~~~~~~~~~~
ディレクトリ「public_html」を
UserDir public_html <Directory "/home/*/public_html"> ...
【2】権限を設定する
sudo chown user:apache ~ chmod 710 ~ chmod 755 ~/public_html
【3】SELinuxの設定する
sudo chcon -R -t httpd_sys_rw_content_t /home/admin/public_html sudo semanage fcontext -a -t httpd_sys_rw_content_t /home/admin/public_html
【4】動作確認
[1] 確認用コンテンツ作成mkdir ~/public_html chmod 755 ~/public_html vi ~/public_html/index.html ~~~~~ Hello World!!? ~~~~~[2] ブラウザで「t;server>/~<username>」にアクセスする
[[http://localhost/~user/]]