From d8fc6a3c3a6de9bd4d92c37e2b260f4f5b394d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=A1=E5=AE=9C=E5=B0=A7?= Date: Fri, 23 Aug 2019 00:07:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6=20for=20docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 ++- docker-compose/nginx.conf | 2 ++ public/.htaccess | 1 + readme.md | 13 +++++++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ac7816b7..a8d2fadb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,8 @@ RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-av RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf RUN echo "memory_limit=-1" > "$PHP_INI_DIR/conf.d/memory-limit.ini" \ - && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > "$PHP_INI_DIR/conf.d/date_timezone.ini" + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > "$PHP_INI_DIR/conf.d/date_timezone.ini" \ + && echo "upload_max_filesize = 100M\npost_max_size = 0" > "$PHP_INI_DIR/conf.d/upload-limit.ini" RUN apt-get update && apt-get install -y \ libfreetype6-dev \ diff --git a/docker-compose/nginx.conf b/docker-compose/nginx.conf index 69130bbc..d2c70204 100644 --- a/docker-compose/nginx.conf +++ b/docker-compose/nginx.conf @@ -7,6 +7,8 @@ server { location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } + client_max_body_size 120M; + location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$query_string; diff --git a/public/.htaccess b/public/.htaccess index 903f6392..cd22dd8f 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -4,6 +4,7 @@ RewriteEngine On + LimitRequestBody 0 # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d diff --git a/readme.md b/readme.md index f41bd552..8667d467 100644 --- a/readme.md +++ b/readme.md @@ -239,6 +239,19 @@ composer 会在在项目目录中创建 **vender** 目录,其中包含了项 $table->increments('id'); ``` +4. 默认上传文件大小限制为 2M,这个限制并不是 Wizard 自身的限制,而是运行环境的限制,如何提高上传文件大小限制呢? + + 首先需要修改 PHP 的配置文件 `php.ini`,修改以下两行 + + ; 上传文件大小限制 + upload_max_filesize = 100M + ; 表单提交大小限制,必须大于 upload_max_filesize,或者可以设置为 0,不做任何限制 + post_max_size = 0 + + 然后,根据 web 服务器的不同进行修改 + + - **nginx**: 在 nginx 配置中添加 `client_max_body_size 120M;` 来指定最大 body 大小,可以参考 `docker-compose/nginx.conf` 的配置 + - **apache**:修改 Wizard 目录 `public/.htaccess` 文件中 `LimitRequestBody 0` 选项的值即可,默认为0表示不限制(默认已经修改过) ## Stargazers over time