Amazon EC2 Ubuntu实例最大文件上传大小 [英] Amazon EC2 Ubuntu Instance Maximum File Upload Size
问题描述
为我提供了一个Amazon EC2 Ubuntu实例.我们的任务是创建一个网络应用程序,其中包括上载客户端视频.我已经在本地主机中创建了一个文件上传应用程序,并且运行正常.将代码迁移到虚拟主机服务器时,我无法上传任何视频,甚至不能上传超过 2Mb
的文件.我尝试将 php.ini
设置为 upload_max_filesize
设置为 50M
,将post_max_size设置为 1000M
.
I was given an Amazon EC2 Ubuntu Instance. We are task to create a web application that includes uploading a client video. I have created a file upload application in my localhost and it is working fine. When I migrated the code to the virtual host server, I cannot upload any video and even any file that exceeds 2Mb
. I tried editing the php.ini
setting upload_max_filesize
to 50M
and post_max_size to 1000M
.
重启Apache多次后,更新未反映在我的 phpinfo()
信息中,但更改保存在我的 php.ini
文件中.
After restarting Apache so many times, the update is not reflected in my phpinfo()
information but changes were saved in my php.ini
file.
我怀疑给我的Amazon EC2实例具有文件上传限制,但是我不确定我是否正确.如果输入错误,如何覆盖下面的配置?任何帮助将不胜感激.
I was suspecting that the Amazon EC2 instance given to me has a file upload restrictions but Im not sure if Im right. If I was wrong, how can I override the configuration below? Any help would be very much appreciated.
更新:
我什至确保我正在编辑正确的配置文件.以下是屏幕截图:
I even made sure that I was editing the correct configuration file. Below are the screen shots:
更新:
我尝试使用链接中的内容没有运气.我对链接有很多疑问,例如:
I tried following what is said in the link with no luck. I have a lot of questions in mind about the link like:
- 塞子对
S3存储桶
意味着什么?我将配置文件上传到/var/www/html/.ebextensions
中.我在做正确的事吗?
- What does tomcatchesides mean about
S3 bucket
? I uploaded the config file in/var/www/html/.ebextensions
. Am I doing the right thing?
我的 zzz.ini
包含以下代码,我将其放在/etc/php.d/zzz.ini
中:
My zzz.ini
contains the code below and I place it in /etc/php.d/zzz.ini
:
[php]
post_max_size = 1000M
upload_max_filesize = 50M
我的 myconfigfile.config
位于/var/www/html/.ebextensions/myconfigfile.config
中,并包含以下代码:
My myconfigfile.config
was located in /var/www/html/.ebextensions/myconfigfile.config
and contains the code below:
files:
"/etc/php.ini":
mode: "000644"
owner: root
group: root
source: http://mybucketname.s3.amazonaws.com/php.ini
"/etc/php.d/zzz.ini":
mode: "000644"
owner: root
group: root
source: http://mybucketname.s3.amazonaws.com/zzz.ini
如何知道我的实例的存储桶名称?
How to know the bucket name of my instance?
我还将 php.ini
从/etc/php/7.0/apache2/php.ini
复制到了/etc/php.ini
并重新启动apache.仍然没有变化.我在做正确的事吗?
I also copied my php.ini
from /etc/php/7.0/apache2/php.ini
to /etc/php.ini
and restarted apache. Still no changes. Am I doing the right thing?
更新:
我向给我EC2实例的人询问存储桶名称,她的答复是.
I ask for the bucket name to the person who gave me the EC2 instance and her reply was.
是的,您可以访问EC2实例.S3是不同的亚马逊提供的服务,该服务不会自动提供给EC2实例.我们可以在S3中为您创建一个存储桶,但可能没有需要更长的时间.
Yes, you were given access to an EC2 instance. S3 is a different service provided by Amazon and that's not automatically available to EC2 instances. We can create a bucket in S3 for you but it may no longer be needed.
EC2实例具有大约8GB的存储空间.你应该能够将多个大于2MB的视频存储在EC2文件系统中,并且直接访问它们.
The EC2 instance has around 8GB storage space. You should be able to store multiple videos greater than 2MB in the EC2 file system and access them directly.
使用S3进行文件上传是一个好主意,尤其是在您的软件中投入生产.但是,为简化设置,请使用文件系统来存储视频.
Using S3 for file uploads is a good idea especially when your software goes to production. However, to simplify the setup, please use the file system instead to store the videos.
更新:
运行以下命令:
php -i | grep -i max_size
收益: post_max_size => 1000M => 1000M
yields: post_max_size => 1000M => 1000M
grep -ir "max_size" /etc/php/7.0/apache2/conf.d/
什么都没做
grep -ir "max_size" /etc/php/7.0/
收益
/etc/php/7.0/fpm/php.ini:post_max_size = 1000M
/etc/php/7.0/apache2/php.ini:post_max_size = 1000M
/etc/php/7.0/cli/php.ini:post_max_size = 1000M
可以通过此链接来访问我的 phpinfo()
>
My phpinfo()
can be access through this link
推荐答案
对不起,打扰大家了,我不好.我为此花了将近4天的时间,结果发现我在php.ini中仅犯了语法错误.我在本地主机中用新安装的php更新了服务器php.ini,并在apache重新启动后更新了phpinfo().
Sorry guys, for bothering all of you, my bad. I was banging my head for this for almost 4 days and it turns out that I have only made a syntax error in my php.ini. I updated my server php.ini with my newly installed php in my localhost and phpinfo() was updated after apache restart.
这篇关于Amazon EC2 Ubuntu实例最大文件上传大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!