2021年4月28日星期三

docker - php - permissions

I am programming a web server using xampp and when uploading it to production where I use docker I have found this problem:

2021/04/28 08:58:19 [crit] 15#15: *4 open() "/var/lib/nginx/tmp/client_body/0000000001" failed (13: Permission denied), client: XXX, server: , request: "POST /admin/data/test.php HTTP/1.1", host: "XXX", referrer: "https://XXX/admin/data/othercsv.php"  

I entered docker using "sh" and changed the permissions with chmod -R 755 /var/lib/nginx and it worked perfectly. later I have seen that with chgrp -R nginx /var/lib/nginx it also worked.

So I have gone to my docker-compose.yaml and added thecommand: bash -c "chgrp -R nginx /var/lib/nginx"; getting a 502 error all over the web, I have tried with everything that crossed my mind and google too, even entrypoint: [ "sh", "-c", "sleep 10 && chgrp -R nginx /var/lib/nginx"] and command: [sh, -c, "chmod -R 755 /var/lib/nginx";]. Also loading external files with the commands and trying to execute them externally. But I have not been lucky.

Code in docker-compose:

  nginx_web:      image: tobi312/php:8.0-fpm-nginx-alpine      hostname: XXX      restart: always      expose:        - "80"      volumes:        - /var/www/html/XXX:/var/www/html:rw      environment:        - VIRTUAL_HOST=XXX        - LETSENCRYPT_HOST=XXX        - LETSENCRYPT_EMAIL=XXX        - ENABLE_NGINX_REMOTEIP=1      networks:        - frontend        - backend      depends_on:         - mongodb         - nginx-proxy  

(I am using docker proxy) Any help is appreciated!

https://stackoverflow.com/questions/67307509/docker-php-permissions April 29, 2021 at 04:31AM

没有评论:

发表评论