LANMP架构下大文件上传需要注意的一些设置

By lincanbin at 2014-12-08 • 0人收藏 • 1959人看过

这是去年搞http://ourjnu.com/的时候踩过的一个坑,今天把Carbon Forum迁移到了DigitalOcean,重新配置Web服务,想起了这个坑,整理了一下写给大家。

LANMP(Linux + Apache + Nginx +MySQL + PHP)是一个比较常见的Web服务架构,由于是Nginx反向代理Apache,这个架构下上传大文件设置不同于LAMP(Linux + Apache  +MySQL + PHP)架构。

除了LAMP架构下需要设置的php.ini外,LANMP大文件上传还需要设置nginx.conf,步骤如下:

1、打开php.ini,找到以下两项,分别改为实际需要的值,例如128M,如果只是LAMP的话这样就够了。

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 128M

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 128M

2、打开nginx.conf,找到一下一项,同样改为需要的值,这是LANMP架构下Nginx反代Apache需要多设置的一项:

    client_max_body_size 128m;

3、重启Web服务

登录后方可回帖

登 录
信息栏

Carbon Forum是一个基于话题的高性能轻型PHP论坛

下载地址:Carbon Forum v5.9.0
QQ群:12607708(QQ我不常上)

donate

手机支付宝扫描上方二维码可向本项目捐款

粤公网安备 44030602003677号
粤ICP备17135490号

Loading...