Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker compose / Nginx: Cannot add manuals to equipment section #15

Open
kingo55 opened this issue Apr 25, 2019 · 6 comments
Assignees

Comments

@kingo55
Copy link

@kingo55 kingo55 commented Apr 25, 2019

Whenever I add a manual PDF, Nginx throws 404 on the PUT request, like so:

Screenshot_20190425_174702

Screenshot_20190425_174715

Screenshot_20190425_174918

Could be an issue with Docker-compose / Nginx config. I'm not really familiar with CRUD, but any ideas on how I can fix?

@berrnd berrnd transferred this issue from grocy/grocy Apr 25, 2019
@berrnd

This comment has been minimized.

Copy link
Member

@berrnd berrnd commented Apr 25, 2019

I moved this issue to grocy/grocy-docker.

Seems to be the same as #11.

Still not using Docker myself, but I also run grocy exclusively on nginx/PHP-FPM and another nginx in front as a reverse proxy, so here is the full config of https://demo-en.grocy.info - maybe that helps...

Application host:

server {
	server_name demo-en.grocy.info;
	
	access_log /var/log/nginx/demo-en.grocy.info.access.log;
	error_log /var/log/nginx/demo-en.grocy.info.error.log;

	root /var/www/demo-en.grocy.info/public;

	location / {
		try_files $uri /index.php;
		
		location ~* \.(php|inc)$ {
			include fastcgi.conf;
			
			fastcgi_pass unix:/run/php/php7.2-fpm.sock;
			fastcgi_index index.php;
			fastcgi_intercept_errors on;
			fastcgi_buffer_size 16k;
			fastcgi_buffers 4 16k;
		}
	}

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

	location = /robots.txt {
		log_not_found off;
		access_log off;
	}

	location ~ /\.ht {
		deny all;
	}
}

Reverse proxy:

server {
	listen 443 ssl http2;
	server_name demo-en.grocy.info;
	
	ssl_certificate /opt/centralcfg/sslcerts/letsencrypt/grocy.info/fullchain.cer;
	ssl_certificate_key /opt/centralcfg/sslcerts/letsencrypt/grocy.info/grocy.info.key;
	ssl_trusted_certificate /opt/centralcfg/sslcerts/letsencrypt/grocy.info/ca.cer;

	ssl_certificate /opt/centralcfg/sslcerts/letsencrypt/grocy.info_ecc/fullchain.cer;
	ssl_certificate_key /opt/centralcfg/sslcerts/letsencrypt/grocy.info_ecc/grocy.info.key;
	
	access_log /var/log/nginx/demo-en.grocy.info.access.log;
	error_log /var/log/nginx/demo-en.grocy.info.error.log;

	location / {
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
		proxy_buffering off;
		proxy_request_buffering off;
		proxy_pass http://192.168.0.106/;
	}
}

server {
	server_name demo-en.grocy.info;
	
	access_log /var/log/nginx/demo-en.grocy.info.log;
	error_log /var/log/nginx/demo-en.grocy.info.log;
	
	return 301 https://$host$request_uri;
}
@berrnd berrnd mentioned this issue Apr 26, 2019
@talmai

This comment has been minimized.

Copy link
Collaborator

@talmai talmai commented May 4, 2019

@berrnd was this resolved in some later version of grocy? would a more recent image fix this?

@berrnd

This comment has been minimized.

Copy link
Member

@berrnd berrnd commented May 4, 2019

No - the screenshot above shows a 404 page of nginx, so the request have not hit grocy - I assume something about URL rewriting could be the problem...

@berrnd

This comment has been minimized.

Copy link
Member

@berrnd berrnd commented May 4, 2019

I'm not a nginx config expert, but you defined the URL rewriting here:

try_files $uri $uri/ /index.php?$query_string;

The following definitely works on all of my installations (see full config above), maybe try changing that... (?)

try_files $uri /index.php;
@jgoett154

This comment has been minimized.

Copy link

@jgoett154 jgoett154 commented May 13, 2019

Quick Addition to the below: Doing chown nobody /var/tmp/nginx seems to fix it as well and probably can be added to the Dockerfile prior to running nginx. I will see if I can get a PR made quickly to fix this hopefully.

I was having this same issue with the 404 error. After a lot of poking around and binding a volume for the nginx log I determined it seems to be caused by a lack of permissions for /var/tmp/nginx/client_body. I am unsure why this is occurring exactly but what appears to happen is a temp file is created in that directory for file uploads and for whatever reason fails to open. Below is the log line that occurs when an upload happens. The reason for the 404 though is caused by a lack of a 50x.html file which would normally be displayed when the error below occurs. I changed the worker processes to be run as root which seems to be working (though obviously not ideal). I am not great at docker or nginx so I am not entirely sure how to go about resolving this. But hopefully this info assists with it being taken care of. I will continue trying different things to get it working but I don't have a huge amount of time during the week.

2019/05/12 23:00:06 [crit] 6#6: *1 open() "/var/tmp/nginx/client_body/0000000001" failed (13: Permission denied), client: 172.18.0.1, server: _, request: "PUT /api/files/productpictures/Y29sYS5qcGVn HTTP/1.1", host: "localhost:8083", referrer: "http://localhost:8083/api"

@talmai

This comment has been minimized.

Copy link
Collaborator

@talmai talmai commented Jul 8, 2019

@jgoett154 when you have some time, can you test this against the latest code? (just updated to 2.4.4 + pushed to dockerhub)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.