Topic on Project:Support desk

Images always showing 403 error

4
NitaiDas (talkcontribs)

I have a feeling this is related to apache directives and URL rewrite.

I have set up MediaWiki on Ubuntu 16 following Wiki family drupal style sites and no matter what I do I get 403 forbidden on all images. That is, images do not show on the wiki, nor when directly navigated to in the URL.

The images directory is outside of the DocumentRoot.

Here is my Apache directives

DocumentRoot "/home/DOMAIN/public_html/mediawiki/mediawiki1.28"
ServerName en.DOMAIN.org
Alias /images "/home/DOMAIN/public_html/mediawiki/sites/images"
<Directory "/home/DOMAIN/public_html/mediawiki/mediawiki1.28">
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}//index.php [L]
## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache
# Enable the rewrite engine
RewriteEngine On
# Short url for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]
# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/index.php [L]
#
Options -Indexes +SymLinksIfOwnerMatch
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>

(In the DocumentRoot and Directory paths symlinks are used, but I have changed to reflect the actual location)

Permissions of the Images directory:

/home/DOMAIN/public_html/mediawiki/sites/images drwxr-xr-x www-data www-data images

All else is DOMAIN:DOMAIN

I have even ran chmod -R 777 images to test.

I have tried with other directories and files in the area where images dir is located, without any success, and that leads me to think that I cannot access ANYTHING outside of the DocumentRoot.

Ciencia Al Poder (talkcontribs)

Your <Directory> directive is for "/home/DOMAIN/public_html/mediawiki/mediawiki1.28", but "/home/DOMAIN/public_html/mediawiki/sites/images is outside of it, so you need to add another <Directory> directive where you can give access permissions

NitaiDas (talkcontribs)

Thanks, I thought so.

What sort of permissions directives would be needed? (site files owned by DOMAIN and images by www-data)

Ciencia Al Poder (talkcontribs)

you can try allow from all and Require all granted, like your example