服务器响应0代码错误-文件大于2MB

时间:2018-07-11 09:56:14

标签: nginx file-upload laravel-5.6 php-7.2 laravel-forge

当我上传一个大文件时,出现了“服务器响应0码”错误。文件大于2MB

我的服务器在Forge上。 (我与Forge团队联系了)

我有一个上传表格。它在DropZoneJs上工作

我增加了php限制(我重新启动了nginfo,可以在phpinfo中看到) post_max_size=100M upload_max_filesize=100M

我还通过添加来使用Nginx设置 client_max_body_size 200M;

我还从Forge中增加了max_file_upload_size。

server {

    listen 80;
    server_name .exampe.tc;

    location = / {

        return 301 https://www.example.com/;
    }

    location / {

        try_files $uri $uri/ /index.php?$query_string;
    }

    root /home/forge/example.com/public;
    index index.html index.htm index.php;
    charset utf-8;
    include forge-conf/example.com/server/*;


    location = /favicon.ico {

        access_log off; log_not_found off;
    }
    location = /robots.txt {

        access_log off; log_not_found off;
    }
    error_page 404 /index.php;

    location ~ \.php$ {

        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {

        deny all;
    }


}


# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/example.com/before/*;


fastcgi_read_timeout 14400;


server {

    proxy_connect_timeout 14400;
    proxy_send_timeout 14400;
    proxy_read_timeout 14400;
    send_timeout 14400;


    client_max_body_size 200M;


    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name .example.com;

    if ($http_host = example.com) {

        rewrite (.*) https://www.example.com;
    }
    root /home/forge/example.com/public;

    # FORGE SSL (DO NOT REMOVE!)
    ssl_certificate /etc/nginx/ssl/example.com/330472/server.crt;
    ssl_certificate_key /etc/nginx/ssl/example.com/330472/server.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'dfdf';
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/example.com/server/*;

    location / {

        fastcgi_read_timeout 14400;
        client_max_body_size 200M;

        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico {

        access_log off; log_not_found off;
    }
    location = /robots.txt {

        access_log off; log_not_found off;
    }

    access_log off;
    error_log /var/log/nginx/example.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {

        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;

        fastcgi_read_timeout 14400;
    }

    location ~ /\.(?!well-known).* {

        deny all;
    }
}


# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/example.com/after/*;

但是我仍然遇到相同的错误。我不知道该怎么办?

0 个答案:

没有答案