Apache error 403 after redirecting Apache to /media/... path

apache ubuntu media http-status-code-403

31 观看


323 作者的声誉

When moving files from my main disk (where the OS is installed), to a second disk (other storage), I am trying to redirect Apache to the new disk, but this returns error number 403. I am running Ubuntu 16.04.

I originally redirected Apache to /home/user/Documents by adding the following lines to corresponding files:

in /etc/apache2/apache2.conf

<Directory /home/jawa/Documents/>
#<Directory /media/jawa/R2D2/Webpages>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

and in /etc/apache2/sites-enabled/000-default.conf

DocumentRoot /home/jawa/Documents
#DocumentRoot /media/jawa/R2D2/Webpages 

This worked fine, but since I have moved the files to a new location, I must also redirect Apache. When trying to redirect Apache to /media/jawa/R2D2/Webpages, I toggle the above comments and restart apache using sudo service apache2 restart. Visiting localhost in the browser returns error 403 and using the command cat /var/log/apache2/error.log gives the following log:

[Wed Dec 27 17:24:48.583062 2017] [core:error] [pid 22343] (13)Permission denied: [client ::1:35704] AH00035: access to / denied (filesystem path '/media/jawa/R2D2') because search permissions are missing on a component of the path

Permissions and owners of both folders:

drwxr-xr-x 2 jawa jawa 4096 dec 27 17:12 Documents
drwxrwxrwx 1 jawa jawa       0 dec 27 16:46 Webpages

What is causing the error and how can it be fixed?

作者: Alexander 的来源 发布者: 2017 年 12 月 27 日

回应 (1)


3903 作者的声誉


Since we know one works and the other does not, list the permissions of both the folder structures :

 ls -ld /home/ /home/jawa /home/jawa/Documents 
 ls -ld /media/ /media/jawa/ /media/jawa/R2D2 /media/jawa/R2D2/Webpages

Once listed compare the two.
The default permissions are controlled by umask and this could result in the permissions being different.

作者: souser 发布者: 27.12.2017 07:38