Can't get Grocy working, getting unknown 50x error
I am trying to set up Grocy on a Fedora 29 LXC container.
I installed nginx, sqlite, php and php-pdo on Fedora (i chose this because neither Debian nor CentOS had PHP 7.2 in their repos) and unzipped the latest release in /var/www, and set the Nginx root to /var/www/public, as the README instructed.
When i load the page i get a 404 error, along with this in /var/log/nginx/error.log:
2018/12/30 23:27:13 [error] 396#0: *69 open() "/var/www/public/50x.html" failed (2: No such file or directory), client: CLIENT IP, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/www.sock", host: "HOST IP"
I understand that it can't find the error html for 50x errors and that this is the cause of the 404 error, but what error am i getting then?
Here is my /etc/nginx/nginx.conf: # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www/public;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
alias /var/www/public;
# index index.php index.html index.htm;
index index.htm index.html /index.php;
# try_files $uri $uri/ @grocy;
try_files index.php $uri $uri/ @grocy;
# autoindex on;
}
location @grocy {
rewrite /(.*)$ /index.php?$query_string last;
}
location ~ /(.+.php)(.*)$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
include /etc/nginx/fastcgi_params;
charset utf8;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
I didn't know what else to include, so let me know if i have missed something.
Posted Dec 30, 2018, 11:42 PM UTC
I would check that permissions are set properly on your php files and the public directory. This is the most common 5xx error I run into with new installs.
(Also, it's just a few extra commands to add an extra apt repo and get PHP 7.2 on a Debian system!)
I think the permissions are correct. I ran
In /var/www (borrowed it from the internet) and have recursively given ownership to the nginx user and group.
ls -l gives me this. The permissions for files and folders are the same in all subdirectories.
It's SELinux, I am doing something you shouldn't and disabling enforcement, but there are ways, putting "selinux PHP sqlite" into Google should give some pointers on how to do it properly
Is there anything in the PHP-FPM log (separate from nginx's log file)?