aws-samples / aws-refarch-wordpress

This reference architecture provides best practices and a set of YAML CloudFormation templates for deploying WordPress on AWS.
MIT No Attribution
1.08k stars 601 forks source link

Increase Default "upload_max_filesize" Parameter #6

Closed jimmyjuarez closed 6 years ago

jimmyjuarez commented 6 years ago

Please Increase Default "upload_max_filesize" Parameter

RGuilfoyle commented 6 years ago

I believe this is a standard php.ini setting and we have not changed the default. I appreciate that many themes, plugins etc will be larger than this. I'll investigate changing the default, as the php.ini file in stored on each instance it is not something that can modified post-deployment as newly launched instance would not have the correct setting.

darrylsosborne commented 6 years ago

Jimmy. This is a standard php.ini file that we don't want to change within the reference architecture. If this configuration is desired in your environment, please make the customization post-deployment. Thanks - Darryl

lfreneda commented 6 years ago

@jimmyjuarez how did you end up increasing this number?

jimmyjuarez commented 6 years ago

Step 1: Download your EC2 keypair (.pem file) on you local machine;

Step 2: Launch the Bastion Host EC2 > Auto Scaling > Auto Scaling Group, set Desired, Min, and Max to “1”, the Bastion Host will launch automatically;

Step 3: Open console/terminal, key in the following commands:

Step 4: Load Keypar $ ssh-add -K /[your-keypair-path]/[your-keypair-file].pem

Step 5: SSH into Bastion Host $ ssh -A ec2-user@[EC2 Bastion Public DNS (IPv4) IP]

Step 6: SSH into Web Server $ ssh -A ec2-user@[EC2 Web ASG Private DNS IP]

Step 7: Open php.ini $ sudo vi /etc/php.ini

Step 8: Edit “Upload Max File Size” parameter (upload_max_filesize = 90M)

Step 9: Restart Apache $ sudo service httpd restart

Step 10: Reset the Auto Scaling Group and Terminate Bastion Host

darrylsosborne commented 6 years ago

Another approach is to use SSH agent.

1) Change the minimum and desired instance count of the Bastion ASG to 1. 2) Follow the instructions on this blog to setup and use SSH agent - https://aws.amazon.com/blogs/security/securely-connect-to-linux-instances-running-in-a-private-amazon-vpc/ 3) SSH to the bastion host using "ssh -A ec2-user@<EC2-PUBLIC-DNS-NAME" 4) From the bastion host, SSH to the web instance using the private ip. Copy the "Connect" command from the EC2 Mgmt Console for the web instance and execute it on the bastion host. 5) Change the settings in the php.ini file and restart.

Question... would you like to include this setting as a CloudFormation parameter? Basically overriding the PHP default setting.

jimmyjuarez commented 6 years ago

@darrylsosborne YES, that would be great! Are there any other parameters that can be included as Best Practice for tuning WordPress servers?

darrylsosborne commented 6 years ago

Please send me the parameters you'd like to adjust and I'll investigate how we can work this into the template(s) as parameters.

jimmyjuarez commented 6 years ago

@darrylsosborne Thanks! I am not a WordPress or PHP or Server expert, but it seems that these are common parameters that need to be adjusted:

I would be interested to see if there are others that I am missing...

lfreneda commented 6 years ago

@darrylsosborne that would be awesome! :D @jimmyjuarez just listed all needed configurations for wp that people usually deal with;