$ mkdir /home/masud/www/
$ sudo nano /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Change it to
<Directory /home/masud/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Allow from all
</Directory>
$ sudo nano /etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/html
Change document root to
DocumentRoot /home/masud/www/
$ sudo service apache2 restart
You have to add the www-data group to your directory:
https://paun.dev/2023/02/28/how-to-add-www-data-user-to-a-folder-in-home-directory/