From 79641f01eeda8af0cb9273102b36ab624e87f415 Mon Sep 17 00:00:00 2001 From: luorijun Date: Sat, 18 Oct 2025 09:14:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9C=AC=E5=9C=B0=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 +++++- Dockerfile | 3 +++ docker-compose.yaml | 49 +++++++++++++++++++++++++++++++++++++++++++++ nginx.conf | 33 ++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml create mode 100644 nginx.conf diff --git a/.gitignore b/.gitignore index 16f2dc5..6e6c1e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -*.csv \ No newline at end of file +*.csv + +.idea/ +.vscode/ +.volumes/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..13c9447 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM php:7.3-fpm-alpine +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories +RUN docker-php-ext-install pdo_mysql mysqli diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..2bde26d --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,49 @@ +name: juipphp + +services: + + mysql: + image: mysql:8.0.21 + environment: + MYSQL_ROOT_PASSWORD: 123456789 + MYSQL_DATABASE: hualianyun + ports: + - "3306:3306" + command: --default-authentication-plugin=mysql_native_password + volumes: + - ./.volumes/mysql:/var/lib/mysql + + php: + build: + context: . + dockerfile: Dockerfile + volumes: + - ./alipay:/var/www/html/alipay + - ./app:/var/www/html/app + - ./config:/var/www/html/config + - ./enum:/var/www/html/enum + - ./extends:/var/www/html/extends + - ./fastphp:/var/www/html/fastphp + - ./script:/var/www/html/script + - ./vendor:/var/www/html/vendor + - ./.htaccess:/var/www/html/.htaccess + - ./index.php:/var/www/html/index.php + depends_on: + - mysql + + nginx: + image: nginx:alpine + volumes: + - ./nginx.conf:/etc/nginx/conf.d/app.conf + - ./alipay:/var/www/html/alipay + - ./app:/var/www/html/app + - ./config:/var/www/html/config + - ./enum:/var/www/html/enum + - ./extends:/var/www/html/extends + - ./fastphp:/var/www/html/fastphp + - ./script:/var/www/html/script + - ./vendor:/var/www/html/vendor + - ./.htaccess:/var/www/html/.htaccess + - ./index.php:/var/www/html/index.php + ports: + - 9000:9000 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..ac473e2 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,33 @@ +server { + listen 9000; + server_name _; + + # CORS + add_header 'Access-Control-Allow-Origin' "$http_origin" always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + + # pre-flight requests + if ($request_method = 'OPTIONS') { + return 204; + } + + index index.php; + root /var/www/html; + + location ~ \.php(.*)$ { + fastcgi_pass php:9000; + include fastcgi_params; + fastcgi_param PATH_INFO $1; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } + + location / { + if (!-e $request_filename) { + rewrite ^/index.php(.*)$ /index.php?s=$1 last; + rewrite ^(.*)$ /index.php?s=$1 last; + break; + } + } +} \ No newline at end of file