Ubuntu 21.04
Sponsored Link

Apache2 : ユーザーのホーム領域を有効にする2021/05/17

 
一般ユーザーが自身のホームディレクトリ内に置いたファイルを Web サイトとして公開できるように設定します。
[1] userdir モジュールを有効にします。
root@www:~#
a2enmod userdir

Enabling module userdir.
To activate the new configuration, you need to run:
  systemctl restart apache2

root@www:~#
systemctl restart apache2

[2] 任意の一般ユーザーでテストページを作成して動作確認をします。正常にページが表示されれば OK です。
ubuntu@www:~$
mkdir ~/public_html

ubuntu@www:~$
chmod 711 /home/ubuntu

ubuntu@www:~$
chmod 755 /home/ubuntu/public_html

ubuntu@www:~$
vi ~/public_html/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
UserDir Test Page
</div>
</body>
</html>
関連コンテンツ