Welcome! Log In Create A New Profile

Advanced

Simple question regarding server-config

Posted by csi_nginx 
Simple question regarding server-config
September 18, 2018 04:54AM
Hi guys,

just a simple question. I've got..

-) a "cam_alarms.php" stored in /var/www/html/
-) and (.avi-)video-files stored in /var/www/html/rec/videos

Browsing the .php via http://[IP]:4444/cam_alarms.php works fine - it generates links to the above mentioned *.avi's, but when I click a link (e.g. http://[IP]:4444/rec/videos/videofile.avi) nginx throws back "404 Not Found".

Could you please have a look at the .conf below? Many thanks in advance & BR, Christian

server {
listen 4444;
server_name [IP];

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS off;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
root /var/www/html;
}

location ~ \.(avi|mp4) {
root /var/www/html/rec/;
}
}
Re: Simple question regarding server-config
September 18, 2018 06:59AM
Look in the logs, the 404 will tell you where nginx expects the file to be.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Simple question regarding server-config
September 18, 2018 09:10AM
Hi @itpp2012, many thanks for your reply.

According to /var/log/nginx/error.log;

2018/09/18 15:02:15 [error] 19354#19354: *7 open() "/usr/share/nginx/html/rec/videos/CCCC.avi" failed (2: No such file or directory), client: A.A.A.A, server: B.B.B.B, request: "GET /rec/videos/CCCC.avi HTTP/1.1", host: "B.B.B.B:4444", referrer: "http://B.B.B.B:4444/cam_alarms.php"

I'm very aware of the fact, that NGINX wants to open /usr/share/nginx/html/rec/videos, though the server's root for port 4444 is defined as "root /var/www/html;".

Thanks & BR,
Christian



Edited 1 time(s). Last edit at 09/18/2018 09:11AM by csi_nginx.
Re: Simple question regarding server-config
September 18, 2018 04:24PM
https://stackoverflow.com/questions/47193849/nginx-root-directive-inside-location-doesnt-seem-to-be-working

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready