修改PHP和Nginx文件上传大小限制

php.ini

//post_max_size 的值务必要大于 upload_max_filesize 的值
post_max_size = 8M
upload_max_filesize = 5M

vhost.conf

server {
    listen       80;
    server_name  api.yezhou.me;
    index index.html index.htm index.php;
    root /data/www/HttpApi/public;
    server_name_in_redirect off;

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

    location ~ .+\.php($|/)
    {
        #fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include       fastcgi.conf;

        fastcgi_split_path_info  ^(.+\.php)(/.*)$;
        fastcgi_param  PATH_INFO $fastcgi_path_info;

        client_max_body_size  5m;  #客户端上传文件大小限制设为5M
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires 30d;
    }
    location ~ .*\.(js|css)?$
    {
        expires 1h;
    }
    #伪静态及日志
    #include /data/server/nginx/conf/rewrite/default.conf;
    access_log /data/server/nginx/logs/api-access.log;
}
nginx -s reload
上一篇 CentOS下安装Git rpm包
下一篇 Nginx location 配置后路径映射问题(路径替换)
目录
文章列表
1 Spring Cloud Gateway中的分布式限流
Spring Cloud Gateway中的分布式限流
2
Swift UI - 给表格添加编辑功能(删除,插入)
Swift UI - 给表格添加编辑功能(删除,插入)
3
Swift - 基本数据类型,常量及变量声明
Swift - 基本数据类型,常量及变量声明
4
Java静态代码块与静态变量定义的执行顺序
Java静态代码块与静态变量定义的执行顺序
5
编译WebRTC for Android
编译WebRTC for Android
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。