Probème pour faire fonctionner ngninx avec phpfpm avec un projet php
Bonjour à tous,
Pourriez vous m'aider s'il vous plaît?
j'ai ajouté docker à un projet sympa php https://github.com/taniarascia/laconia cela fonctionné avant la pull request et maintenant j'ai des problèmes avec nginx :(
Le problème est que quand je vais sur le localhost:8000 ça me télécharge le index.php du coup je pense que c'est liée à la communication avec phpfpm.
Mes log lors du docker-compose up
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
root@debian:/home/kevin/test/laconia# docker-compose up
Starting laconia_mysql_1 ... done
Starting laconia_my_app_1 ... done
Starting laconia_my_nginx_1 ... done
Attaching to laconia_mysql_1, laconia_my_app_1, laconia_my_nginx_1
mysql_1 | 2019-08-29T15:15:54.947196Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql_1 | 2019-08-29T15:15:54.948579Z 0 [Note] mysqld (mysqld 5.7.26) starting as process 1 ...
my_app_1 | [29-Aug-2019 15:15:55] NOTICE: fpm is running, pid 1
mysql_1 | 2019-08-29T15:15:54.952547Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql_1 | 2019-08-29T15:15:54.952570Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql_1 | 2019-08-29T15:15:54.952580Z 0 [Note] InnoDB: Uses event mutexes
mysql_1 | 2019-08-29T15:15:54.952589Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql_1 | 2019-08-29T15:15:54.952598Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
mysql_1 | 2019-08-29T15:15:54.952607Z 0 [Note] InnoDB: Using Linux native AIO
my_app_1 | [29-Aug-2019 15:15:55] NOTICE: ready to handle connections
mysql_1 | 2019-08-29T15:15:54.952896Z 0 [Note] InnoDB: Number of pools: 1
mysql_1 | 2019-08-29T15:15:54.953016Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysql_1 | 2019-08-29T15:15:54.954617Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
mysql_1 | 2019-08-29T15:15:54.964018Z 0 [Note] InnoDB: Completed initialization of buffer pool
mysql_1 | 2019-08-29T15:15:54.965837Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mysql_1 | 2019-08-29T15:15:54.980986Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
mysql_1 | 2019-08-29T15:15:55.048523Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
mysql_1 | 2019-08-29T15:15:55.048782Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
mysql_1 | 2019-08-29T15:15:55.375066Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
mysql_1 | 2019-08-29T15:15:55.375860Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
mysql_1 | 2019-08-29T15:15:55.375874Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
mysql_1 | 2019-08-29T15:15:55.376391Z 0 [Note] InnoDB: 5.7.26 started; log sequence number 12368861
mysql_1 | 2019-08-29T15:15:55.376625Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mysql_1 | 2019-08-29T15:15:55.376902Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysql_1 | 2019-08-29T15:15:55.377988Z 0 [Note] InnoDB: Buffer pool(s) load completed at 190829 15:15:55
mysql_1 | 2019-08-29T15:15:55.380108Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
mysql_1 | 2019-08-29T15:15:55.380338Z 0 [Warning] CA certificate ca.pem is self signed.
mysql_1 | 2019-08-29T15:15:55.382046Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
mysql_1 | 2019-08-29T15:15:55.382076Z 0 [Note] IPv6 is available.
mysql_1 | 2019-08-29T15:15:55.382089Z 0 [Note] - '::' resolves to '::';
mysql_1 | 2019-08-29T15:15:55.382104Z 0 [Note] Server socket created on IP: '::'.
mysql_1 | 2019-08-29T15:15:55.384720Z 0 [Warning] 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 | 2019-08-29T15:15:55.394171Z 0 [Note] Event Scheduler: Loaded 0 events
mysql_1 | 2019-08-29T15:15:55.394400Z 0 [Note] mysqld: ready for connections.
mysql_1 | Version: '5.7.26' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
my_nginx_1 | 172.20.0.1 - - [29/Aug/2019:15:16:06 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0" |
Mon docker-compose.yml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| version: '3'
services:
my_app:
build: .
image: my_app
depends_on:
- mysql
volumes:
- ./:/app
mysql:
image: mysql:5.7
ports:
- '3312:3306'
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=laconia
- MYSQL_USER=root
- MYSQL_PASSWORD=root
volumes:
- ./storage/tmp/db:/var/lib/mysql
my_nginx:
image: nginx
ports:
- '8000:8000'
volumes:
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
- ./:/app
depends_on:
- my_app |
Le fichier de configuration nginx
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| server {
listen 8000;
root /app/public;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
rewrite ^/?edit/(.*?)/?$ /edit?list_id=$1 break;
rewrite ^(.*)$ /index.php?username-router=$1 break;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass my_app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
} |
J'en profite pour une question, j'ai à chaque fois des problème de caches?
Merci à vous.