Mengganti Directory Apache2 Linux

  1. Copy the default virtual host configuration to alamat yang diinginkan (sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mynewsite.conf)
  2. Edit file barunya (sudo vim /etc/apache2/sites-available/mynewsite.conf) and change theDocumentRoot to your own (save and close..)
  3. Enable this new configuration file (sudo a2ensite mynewsite.conf) and dissable the default one (sudo a2dissite 000-default.conf)
  4. Edit the apache2.conf (sudo gedit /etc/apache2/apache2.conf) and change the default -section into this:  <Directory [write_your_dir_here]> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> (save and close..)
  5. Restart Apache2 (sudo service apache2 restart)

If not then you should check if your directory (and the full path leading up to it!) has the right read and execute-permissions (r-x).

  1. Go to your root (cd /) and do ls -l where you can see something like drwxr-xr-x 14 root root 4096 mei 1 01:24 [your_directory].
  2. All your directories leading up to the www-folder should have the “drwxr-xr-x”-permissions, if not you can change it using sudo chmod -R a+rx [your_directory]

If you still can’t get it to work, you should check the apache error-log (sudo gedit /var/log/apache2/error.log) and dig further…

Good luck!