Add php support to nginx
parent
1c7ebb90fd
commit
243c1805e4
|
|
@ -6,6 +6,15 @@ services:
|
|||
restart: always
|
||||
volumes:
|
||||
- static-files:/usr/share/nginx/html
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
networks:
|
||||
- nginx-network
|
||||
|
||||
php:
|
||||
image: php:8.2-fpm
|
||||
restart: always
|
||||
volumes:
|
||||
- static-files:/var/www/html # same volume as Nginx
|
||||
networks:
|
||||
- nginx-network
|
||||
|
||||
|
|
@ -26,6 +35,7 @@ services:
|
|||
volumes:
|
||||
static-files:
|
||||
name: ${STATIC_FILES_VOLUME_NAME}
|
||||
|
||||
networks:
|
||||
nginx-network:
|
||||
name: ${NGINX_NETWORK}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name localhost; # or your staging domains
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass php:9000; # points to the PHP-FPM service
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue