Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Simple Apache setup to stream mp4 files |
|
Author |
|
ricobasso
Joined: 26 Sep 2021 Posts: 4 Location: UK
|
Posted: Sun 26 Sep '21 12:19 Post subject: Simple Apache setup to stream mp4 files |
|
|
Hello,
oldtime Unix user and new Linux user here.
I want to serve mp4 files to the "Fulgaz" bike trainer app running on Windows 10 (and eventually Apple TV).
I have a fresh Lubuntu installation on an old laptop. I have run updates and installed samba and apache2. They are both reported as running by "systemctl status".
I was successful in changing the smb.config file so that I have no problem seeing the windows machine from Linux or the samba shares from Windows. Samba seems OK.
However, I'm struggling a bit with Apache. All the mp4 files are stored on the laptop under /home/username/Fulgaz_Rides.
I've added
DocumentRoot "/home/username/Fulgaz_Rides"
to the /etc/apache2/apache2.conf file but when I try to view an mp4 from a browser I get "NOT FOUND"
(I'm entering the ip address:port/mp4 file name in the browser address) I've tried port 80 and 8080
There's clearly more to it than just adding the document root to the config file but what? Most online setup guides are about setting up webservers but I just want to serve mp4 files. Can anyone here help, please? |
|
Back to top |
|
mraddi
Joined: 27 Jun 2016 Posts: 152 Location: Schömberg, Baden-Württemberg, Germany
|
Posted: Sun 26 Sep '21 22:19 Post subject: |
|
|
Good evening Rico,
getting a 404-Not-Found is a partly good thing - you have at least reached your webserver
These are the things that come to my mind:
After changing Apache's config you have to restart the service (but I guess you know this): sudo service apache2 restart
For Apache you can check the config with httpd -t and httpd -S - the latter will give you some notes of some config-settings including the default Document Root.
And the user Apache is running as (on my Linux-distributions [Debian + Ubuntu] it is www-root with group www-root) needs to have at least read-access to the file (and IIRC read+execute-access for the directory).
Maybe you find a hint in Apache's log-files - often locatet at /var/log/apache2/
Best regards
Matthias |
|
Back to top |
|
ricobasso
Joined: 26 Sep 2021 Posts: 4 Location: UK
|
Posted: Mon 27 Sep '21 10:59 Post subject: |
|
|
thanks for the response
yes I knw about restarting apache
I don't have the httpd command in Lububtu
As a test, I went back to the standard Document Root (/var/www/html) and put an mp4 file in there. It plays in a browser, no problem.
Then I renamed the html folder to html.old and created a new html folder which was a link to the folder with all my mp4 files in my hone directory.
That does not work. I get 403 Forbidden. I tried to change ownership and permissions of the link, back and forth from root to myself and still could not get it to work.
I'm running out of ideas |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 348 Location: UK
|
Posted: Mon 27 Sep '21 22:20 Post subject: |
|
|
Apache layout on Ubuntu is a little different to the standard ASF release.
Your Apache binary will be /usr/sbin/apache2, but accessed through control script /usr/sbin/apache2ctl, and /usr/sbin should be in your path by default.
So try "apache2ctl -S" to report your system configuration and "apache2ctl -t" to test your configuration files.
Notably, if you look in /etc/apache2/apache2.conf there's a security section including using symlnks which says:
Code: | # Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory> |
So you'll need to add a directory section somewhere which grants access to "/home/username/Fulgaz_Rides".
As mraddi says, you'll also need to ensure user and group target file access permssions to APACHE_RUN_USER and APACHE_RUN_GROUP (www-data) in /etc/apache2/envvars. I think this is why you're getting the 403 error.
With these settings in place you should be able to change your DocumentRoot to "/home/username/Fulgaz_Rides". |
|
Back to top |
|
|
|
|
|
|