aschmelyun / docker-compose-wordpress

A docker-compose workflow for local WordPress development
241 stars 151 forks source link

Nginx php config errors #1

Closed adrianalin89 closed 3 years ago

adrianalin89 commented 3 years ago

I keep getting some errors when I'm trying to run this.

~/test$ docker-compose up

Creating network "test_default" with the default driver Creating test_php_1 ... done Creating test_mysql_1 ... done Creating test_nginx_1 ... done Attaching to test_mysql_1, test_php_1, test_nginx_1 mysql_1 | 2021-04-11 07:24:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started. nginx_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration nginx_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ mysql_1 | 2021-04-11 07:24:00+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' mysql_1 | 2021-04-11 07:24:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started. nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh php_1 | [11-Apr-2021 07:24:01] NOTICE: fpm is running, pid 1 mysql_1 | 2021-04-11T07:24:00.576418Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 1 nginx_1 | 10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf mysql_1 | 2021-04-11T07:24:00.585796Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. nginx_1 | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version mysql_1 | 2021-04-11T07:24:00.764293Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh php_1 | [11-Apr-2021 07:24:01] NOTICE: ready to handle connections nginx_1 | /docker-entrypoint.sh: Configuration complete; ready for start up mysql_1 | 2021-04-11T07:24:00.878672Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock mysql_1 | 2021-04-11T07:24:00.959117Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. mysql_1 | 2021-04-11T07:24:00.959323Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. mysql_1 | 2021-04-11T07:24:00.965843Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. mysql_1 | 2021-04-11T07:24:00.995846Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL. nginx_1 | 2021/04/11 07:24:07 [crit] 30#30: 1 connect() to unix:/tmp/php-cgi.socket failed (2: No such file or directory) while connecting to upstream, client: 172.18.0.1, server: wordpress-docker.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.socket:", host: "localhost" nginx_1 | 2021/04/11 07:24:07 [warn] 30#30: 1 upstream server temporarily disabled while connecting to upstream, client: 172.18.0.1, server: wordpress-docker.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.socket:", host: "localhost" nginx_1 | 2021/04/11 07:24:07 [error] 30#30: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.18.0.1, server: wordpress-docker.test, request: "GET / HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "localhost" php_1 | 172.18.0.4 - 11/Apr/2021:07:24:07 +0000 "GET /index.php" 404 nginx_1 | 172.18.0.1 - - [11/Apr/2021:07:24:07 +0000] "GET / HTTP/1.1" 404 27 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0" "-"

FlareDecoy commented 3 years ago

Hey there, I stumbled upon the same problem, could you please explain how you managed to solve it ? I saw somewhere it had something to do with r/w permissions, I have no idea how to work around this.

Thanks for the tutorial, btw, people like you is what makes the IT work less of a hassle (when you're a newb anyway) :D

adrianalin89 commented 3 years ago

Seems there is a gap between the youtube video and the files over on git. Just grab be files from the repo. Also if you want to know more about r/w permission your need to look in to "chown" and "chmod" commands. One will set permisions to the files to a user_name:user_group and the other will set permission as a number on what exactly you can do whit the file like r/w/d

FlareDecoy commented 3 years ago

Alright, I saw that in the files on git, thanks ! What happens, anyway ? The default user doesn't have permissions to use cgli ? That's weird, because I never had such a problem before, it only ever happened in Docker. Does that have something to do with the fact that we're using a distant resource (upstream) as opposed to having everything on the same machine as usual ?

Kos-M commented 2 years ago
nginx         | 2021/09/29 13:39:15 [warn] 32#32: *737 upstream server temporarily disabled while connecting to upstream, client: 172.18.0.1, server: wordpress-docker.test, request: "GET /wp-cron.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.socket:", host: "127.0.0.1"

i think i encounter this issue too. nginx keeps complaining about php socket Maybe php restarts on error ? and ngninx cant find php socket ? I curl docker site /wp-cron.php ever 2 sec in a loop , and prints some erro_logs in php when i see the above error. im suspecting this config has to do about it:

upstream php {
    server unix:/tmp/php-cgi.socket;
    server php:9000;
}
...  nginx-> default.conf

Any ideas ?