From 73e3fc7391e3f7863f3027b6abcda4391816e09b Mon Sep 17 00:00:00 2001 From: tradewind Date: Tue, 8 Jun 2021 18:48:13 +0800 Subject: [PATCH] #tradewind:fix nginx & zip --- docker-compose.yml | 11 ++++------- nginx/conf.d/example.conf | 31 ++++++++++++++++--------------- php7.4/dockerfile | 2 +- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 91c476a..566cab8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: - ./nginx/sources.list:/etc/apt/sources.list - ${LOCAL_CODE_ROOT}:/var/www/http - ./log/nginx:/var/log/nginx - container_name: nginx-server + container_name: nginx restart: always php7.4: build: @@ -25,22 +25,19 @@ services: - ${LOCAL_CODE_ROOT}:/var/www/http networks: - server - container_name: php7.4 + container_name: php74 ports: - 9000:9000 restart: always - mysql: # 添加 mysql 服务 + mysql: build: context: mysql/ dockerfile: dockerfile restart: always environment: MYSQL_ROOT_PASSWORD: root - # command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci # 设置编码 - # command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集 command: --default-authentication-plugin=mysql_native_password -# volumes: -# - ${MYSQL_DATA_PATH}:/var/lib/mysql +# platform: linux/amd64 # apple silicon networks: - server ports: diff --git a/nginx/conf.d/example.conf b/nginx/conf.d/example.conf index 3bb969c..a10358d 100644 --- a/nginx/conf.d/example.conf +++ b/nginx/conf.d/example.conf @@ -1,18 +1,19 @@ server { - listen 80; - server_name example.com; - root /var/www/http/example; - location / { - index index.php index.html error/index.html; - autoindex off; - } - location ~ \.php(.*)$ { - fastcgi_pass php7.4:9000; - fastcgi_index index.php; - fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; - include fastcgi_params; + listen 80; + server_name example.com; + root /var/www/http/example; + index index.php; + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + fastcgi_pass php7.4:9000; + fastcgi_index index.php; + fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + include fastcgi_params; } } diff --git a/php7.4/dockerfile b/php7.4/dockerfile index f728f84..5ebe62b 100644 --- a/php7.4/dockerfile +++ b/php7.4/dockerfile @@ -12,7 +12,6 @@ RUN apk add --no-cache --virtual .build-deps \ libxml2-dev \ postgresql-dev \ sqlite-dev \ - libzip-dev \ && apk add --no-cache \ curl \ git \ @@ -20,6 +19,7 @@ RUN apk add --no-cache --virtual .build-deps \ mysql-client \ postgresql-libs \ openssl \ + libzip-dev \ && pecl install imagick \ && docker-php-ext-enable imagick \ && pecl install xdebug-3.0.4 \