[MediaWiki-l] Problem with upload directory outside web root

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[MediaWiki-l] Problem with upload directory outside web root

Jon Theil Nielsen
Hi list users,

I have been through many manuals without finding something useful.
I have a common code base and a couple of sites.

Uploads should be outside the web root. To keep it organized and to save
space on the servers drive.
URL's should not reflect the actual path to the upload directory.

I have tried something like
$wgUploadDirectory = "/home/someuser/mediawiki/files";
$wgUploadPath = "{IP}/img";

I /can/ upload e.g. an image. I can see it in the list and I can find it
in the automatically generated subdirectory. But when I click on the
image link, I get an error like
"The requested URL /usr/local/www/mediawiki/img/4/4f/IMG_4025a.jpg was
not found on this server."

I guess I could solve the problem by using a symlink from the sites
images directory to the other directory. But I think there /should/ be a
way to do it by setting the right options in the LocalSettings.php.

Regards,
Jon Theil Nielsen
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with upload directory outside web root

Benjamin Lees
On Sun, Jan 17, 2016 at 7:30 PM, Jon Theil Nielsen <[hidden email]> wrote:
> Uploads should be outside the web root. To keep it organized and to save
> space on the servers drive.

I don't see how space-saving comes into it (though it could help for
putting all the space on a different drive).

$wgUploadPath is a URL path, rather than a filesystem path.  A symlink
is a simple way to handle the mapping between the URL path and the
filesystem path.  An Apache alias would probably also work fine.  I
don't think it can be done in LocalSettings.php alone.

_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with upload directory outside web root

Jon Theil Nielsen
>> Uploads should be outside the web root. To keep it organized and to save
>> space on the servers drive.
>
> I don't see how space-saving comes into it (though it could help for
> putting all the space on a different drive).
>
> $wgUploadPath is a URL path, rather than a filesystem path.  A symlink
> is a simple way to handle the mapping between the URL path and the
> filesystem path.  An Apache alias would probably also work fine.  I
> don't think it can be done in LocalSettings.php
The base system, where the web server lives, has limited space, while /home is on another drive.
I guess I have to try the symlink or the apache alias.
Thanks for the answer. :-)

Regards,
Jon
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with upload directory outside web root

Phil Legault
In reply to this post by Jon Theil Nielsen
Hi Jon
I have created a symbolic link for my images and it works fine.

ln -s /path/to/file /path/to/symlink

I have the whole web root of the system root drive

Ex -> /app/mw/images
Created symbolic link off the web root

ln -s /app/images /app/mw/images



-----Original Message-----
From: MediaWiki-l [mailto:[hidden email]] On Behalf Of Jon Theil Nielsen
Sent: Sunday, January 17, 2016 7:31 PM
To: [hidden email]
Subject: [MediaWiki-l] Problem with upload directory outside web root

Hi list users,

I have been through many manuals without finding something useful.
I have a common code base and a couple of sites.

Uploads should be outside the web root. To keep it organized and to save space on the servers drive.
URL's should not reflect the actual path to the upload directory.

I have tried something like
$wgUploadDirectory = "/home/someuser/mediawiki/files"; $wgUploadPath = "{IP}/img";

I /can/ upload e.g. an image. I can see it in the list and I can find it in the automatically generated subdirectory. But when I click on the image link, I get an error like "The requested URL /usr/local/www/mediawiki/img/4/4f/IMG_4025a.jpg was not found on this server."

I guess I could solve the problem by using a symlink from the sites images directory to the other directory. But I think there /should/ be a way to do it by setting the right options in the LocalSettings.php.

Regards,
Jon Theil Nielsen
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l