The original post: /r/nginx by /u/Trial_and_3rr0r on 2025-02-14 11:13:03.

Hey guys, I really tried my best but now it is time to ask you for your help or some hints.

Quite simple situation:

I have a php file and I want to play a video on it.

<?php
$video_file = '/data/media/small.mp4';
?>
<!DOCTYPE html>
<html><body>

<video src="<?php echo ($video_file); ?>" controls type="video/mp4">
  Ihr Browser kann dieses Video nicht wiedergeben.
</video>

</body></html>

I also modified the default.conf file as follows (for “location /media/” I also tried “location ~/.mp4”):

server {
    listen 80;
    server_name localhost;
    root /var/www/html;
    index index.php index.html;

    location ~ \.php$ {
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param  SCRIPT_FILENAME $document_root/$fastcgi_script_name;
        include fastcgi_params;
    }

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

#    location ~ /\.ht {
#        deny  all;
#    }
    location /media/ {
        mp4;
        root /data/media;
        mp4_buffer_size       4m;
        mp4_max_buffer_size   10m;
    }
}

I am starting the container via docker compose I am mounting the volumes and within the container I am able to find the media files within the correct directory. And so far everything (excepting media files) is working perfect.

When I try to open the desired page in firefox, where the mentioned video player is embbed, I get the error “No video with supported format and MIME type found”. I am really new to all the nginx stuff etc. Thus I do not have any idea where to look. Is there anyone who can help me?