1

I would like to change my apache root server ( /var/www >>> /media/mhsohag11/Local Disk/Sites ). For that directory path has been changed from /etc/apache2/apache2.conf

<Directory "/media/mhsohag11/Local Disk/Sites">
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

Edited also VirtualHost file located /etc/apache2/site-available/000-default.conf

Edited code below :

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName wp.local
        DocumentRoot "/media/mhsohag11/Local Disk/Sites/wp"
        ServerAlias www.wp.local

</VirtualHost>

After putting all changes , all services also restarted.

Then I hit http://localhost or http://wp.local and showing this forbidden message :

Forbidden You don't have permission to access / on this server. Apache/2.4.29 (Ubuntu) Server at localhost Port 80

1
  • When you use non-standard directories you also have to allow such in /etc/apache2/apache2.conf. See this answer. Apr 30, 2019 at 21:37

1 Answer 1

1

The user 'www-data' needs at least read permissions (and for wordpress, write permissions) for the /media/mhsohag11/Local Disk/Sites/ directory. Run the following at a command line:

chgrp -R www-data /media/mhsoha11/Local\ Disk/Sites

chmod -R 664 /media/mhsoha11/Local\ Disk/Sites

This changes the group to the web server and gives the web server read and write permissions recursively to all files and directories under /media/mhsoha11/Local\ Disk/Sites inclusive.

4
  • when put this command , showing below output : mhsohag11@MHS:~$ chgrop www-data /media/mhsoha11/Local\ Disk/Sites Command 'chgrop' not found, did you mean: command 'chgrp' from deb coreutils command 'chprop' from deb karma-tools Try: sudo apt install <deb name> Apr 30, 2019 at 19:27
  • Sorry that is not correct. See my edit Apr 30, 2019 at 19:37
  • your instruction have been followed . Then i restarted apache2 and try again but can't access yet ! Showing list of folder with permission value mhsohag11@MHS:/media/mhsohag11/Local Disk/Sites$ ls -al total 28 drwxrwxrwx 1 mhsohag11 mhsohag11 0 Apr 20 17:29 . drwxrwxrwx 1 mhsohag11 mhsohag11 28672 Apr 20 17:26 .. drwxrwxrwx 1 mhsohag11 mhsohag11 0 Apr 30 10:02 wp mhsohag11@MHS:/media/mhsohag11/Local Disk/Sites$ Apr 30, 2019 at 20:04
  • In apache2.conf, try removing the quotes from the <Directory /path/to/root> tag. You will probably need to escape the space so it looks like: <Directory /media/mhsoha11/Local\ Disk/Sites/>. Also, remove the quotes from DocumentRoot in sites-available. Just for kicks run a2ensite 000-default as well. It looks right to me otherwise. Then restart apache apachectrl restart or systemctl restart apache2. Apr 30, 2019 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .