Ubuntu 18 更改Apache根目錄

Step1

如將/var/www/html改為/home/user/www/html

sudo nano /etc/apache2/sites-enabled/000-default.conf

找到

DocumentRoot /var/www/html

改為

DocumentRoot /home/user/www/html

Step2

sudo nano /etc/apache2/apache2.conf

<Directory /var/www>

改為

<Directory /home/user/www/html>

Step3

重新啟動Apache

sudo systemctl restart apache2