update php docker compose

This commit is contained in:
xfy
2024-07-03 09:28:35 +08:00
parent 8783aa63d1
commit 60cd02b890
7 changed files with 59 additions and 9 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
**/*/.DS_Store
lazygit/state.yml
tmux/plugins
**/*/mysql

View File

@ -1,14 +1,12 @@
version: "3.9"
services:
web:
image: nginx:alpine
ports:
- "4000:80"
volumes:
- ./src:/var/www/html
- ./conf.d/:/etc/nginx/conf.d/
- ./nginx.conf:/etc/nginx/nginx.conf
- .:/var/www/html
- ./nginx/conf.d/:/etc/nginx/conf.d/
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
links:
- php-fpm
@ -17,8 +15,14 @@ services:
platform: linux/amd64
environment:
MYSQL_ROOT_PASSWORD: qwer1234
volumes:
- ./mysql:/var/lib/mysql
deploy:
resources:
limits:
memory: 8G
php-fpm:
image: php:7-fpm-alpine
volumes:
- ./src:/var/www/html
- .:/var/www/html

View File

@ -0,0 +1,48 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
root /var/www/html/public;
index index.php index.html;
#error_page 404 /404.html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

View File

@ -1,16 +1,13 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;