Apache does not serve some symlinked video files
Posted: Wed Aug 14, 2019 8:06 am
I have an RPi3 with apache2 serving a video website for my family's use.
The video files are inside the home dir (~/www/videos) in subdirectories depending on type.
I have symlinked the videos dir as sudo into /var/www so they can be accessed and served out by apache.
This works fine and I can edit the videos inside the home dir while serving from the document root below /var/www.
Today I wanted to make a collection of the latest videos available inside a new dir below videos (videos/latest).
So I created the latest dir and then symlinked a few videos into the latest dir as user pi (all inside home is done as pi).
The result is that the files are listed when accessing the latest dir in a web browser just like when entering the other dirs containing actual files.
But when I click the file the video does not start playing, instead the browser displays an error message:
The index.php renders the content in the dir by making a dir list showing only mp4 files each with a link to show the video through a call to video.php.
The page rendering in index.php works fine and a proper link is created for every found mp4 file.
But the link in the page does not work - it is of this form:
and the video.php file will add .mp4 to the supplied argument videofile and serve it out.
I use the same php code in all directories and in those where the video file is a physical file it works fine but here it is a symlinked file and now it does not work when actually serving the file content.
Why is this so and what can I do to fix it?
EDIT:
Maybe it is not possible for files that are symlinked twice like these are? At least as seen from Apache's point of view.
But they do show up in file listings...
The video files are inside the home dir (~/www/videos) in subdirectories depending on type.
I have symlinked the videos dir as sudo into /var/www so they can be accessed and served out by apache.
This works fine and I can edit the videos inside the home dir while serving from the document root below /var/www.
Today I wanted to make a collection of the latest videos available inside a new dir below videos (videos/latest).
So I created the latest dir and then symlinked a few videos into the latest dir as user pi (all inside home is done as pi).
The result is that the files are listed when accessing the latest dir in a web browser just like when entering the other dirs containing actual files.
But when I click the file the video does not start playing, instead the browser displays an error message:
If I do an ls-l inside the dir I get this:No video with supported format and MIME type found.
Code: Select all
$ ls -l
total 8
lrwxrwxrwx 1 pi pi 57 Aug 14 09:14 2019-08-13_16PM_Deadline.mp4 -> 2019-08-13_16PM_Deadline.mp4
lrwxrwxrwx 1 pi pi 42 Aug 14 09:16 2019-08-13_17PM_MTP.mp4 -> 2019-08-13_17PM_MTP.mp4
-rw-rw-r-- 1 pi pi 157 Aug 14 09:21 index.php
-rw-rw-r-- 1 pi pi 157 Aug 14 09:20 video.php
The page rendering in index.php works fine and a proper link is created for every found mp4 file.
But the link in the page does not work - it is of this form:
Code: Select all
https://video.xxxxxxx.com/latest/video.php?videofile=2019-08-13_17PM_MTP
I use the same php code in all directories and in those where the video file is a physical file it works fine but here it is a symlinked file and now it does not work when actually serving the file content.
Why is this so and what can I do to fix it?
EDIT:
Maybe it is not possible for files that are symlinked twice like these are? At least as seen from Apache's point of view.
But they do show up in file listings...