Welcome! Log In Create A New Profile

Advanced

using nginx with server root on different drive

Posted by lafnlab 
using nginx with server root on different drive
June 26, 2022 03:41PM
Hi all,

I recently built a new PC which runs Linux Mint 20.3 on a 1 TB M2 SSD and stores multiple TB on a 3.5" HDD which is mounted at /mnt/BigMedia.

I'm writing some PHP code that I call Galleria which is supposed to take image files and display them on a page. I've set it up in two places for testing purposes. When it's run from /var/www/my-galleria, it works fine, though it can't see or connect to any files in /mnt/BigMedia/images.

I tried to fix this problem by running the same PHP code at /mnt/BigMedia/my-galleria, but when I run it from there, I get a 404 error from nginx. All the permissions for this directory are set correctly. The user and group for the directory is www-data, but this stop the errors from occurring.

Here is the my-galleria file under sites-available

server {
listen 127.0.0.20;
server_name my-galleria my-galleria.localhost;

# root /var/www/my-galleria;
root /mnt/BigMedia/my-galleria;

index index.php;

location / {
# root /mnt/BigMedia/my-galleria;
# index index.php;
try_files $uri $uri/ =404;
}

location = /favicon.ico {
return 204;
access_log off;
log_not_found off;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}

}

Here are the latest entries from access.log

127.0.0.1 - - [26/Jun/2022:14:22:23 -0400] "GET /index.php HTTP/1.1" 404 134 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0"
127.0.0.1 - - [26/Jun/2022:14:30:37 -0400] "GET /index.php HTTP/1.1" 404 134 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0"
127.0.0.1 - - [26/Jun/2022:14:32:01 -0400] "GET /index.php HTTP/1.1" 404 134 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0"
127.0.0.1 - - [26/Jun/2022:15:22:55 -0400] "GET /index.php HTTP/1.1" 404 134 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0"
127.0.0.1 - - [26/Jun/2022:15:23:14 -0400] "GET /index.php HTTP/1.1" 404 134 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0"

Here are the latest entries from error.log

2022/06/26 14:22:14 [info] 18478#18478: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2022/06/26 14:30:32 [info] 18619#18619: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2022/06/26 14:30:37 [crit] 18633#18633: *1 stat() "/mnt/BigMedia/my-galleria/index.php" failed (13: Permission denied), client: 127.0.0.1, server: my-galleria, request: "GET /index.php HTTP/1.1", host: "my-galleria"
2022/06/26 14:32:01 [crit] 18633#18633: *2 stat() "/mnt/BigMedia/my-galleria/index.php" failed (13: Permission denied), client: 127.0.0.1, server: my-galleria, request: "GET /index.php HTTP/1.1", host: "my-galleria"
2022/06/26 14:36:28 [info] 966#966: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2022/06/26 15:22:55 [crit] 1073#1073: *1 stat() "/mnt/BigMedia/my-galleria/index.php" failed (13: Permission denied), client: 127.0.0.1, server: my-galleria, request: "GET /index.php HTTP/1.1", host: "my-galleria"
2022/06/26 15:23:11 [info] 6111#6111: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63
2022/06/26 15:23:14 [crit] 6124#6124: *1 stat() "/mnt/BigMedia/my-galleria/index.php" failed (13: Permission denied), client: 127.0.0.1, server: my-galleria, request: "GET /index.php HTTP/1.1", host: "my-galleria"

Is there some configuration setting in nginx that stops it from reaching a server root on a different drive? Is there any way to overcome this? Am I overlooking something? Let me know if more information is needed.

Thanks.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 278
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready