Edit settings for NGINX, PHP, and more for AMIMOTO AMI
AMIMOTO AMIs use a few config files to manage the entire server. These settings are provisioned using Chef.
If you're not familiar with Chef, no worries, we write the scripts for you and all you need to do is add your preferred settings and run one command.
It's an easy way to handle all the settings and apply them to multiple environments. amimoto.json stores all parameters for the server. Editing this file, you change PHP and NGINX settings and maintain those settings during reboot. The parameters on amimoto.json overwrites your direct changes to PHP or NGINX.
Only root user can edit it. To role as a root user, please check Login as root document.
Configurable values.
Here are some example: client_max_body_size for Nginx, max_allowed_packet for MySQL, memory_limit for PHP and more. You can modify all of the values listed on Launch-with-1-Click/lw1-amimoto2. For Amazon Linux 1, refer to Launch-with-1-Click/lw1-amimoto.
File to edit
/opt/local/amimoto.json
Commands after editing the file.
After modifying, run all of the following commands.
1. Provisioning as a root user
# /opt/local/provision
2. Restarting services as a root user
# service monit stop
# service nginx restart
# service php-fpm restart
# service mysql restart
# service monit start
Some samples for configuring amimoto.json file.
Changing memory limit for PHP
To change memory_limit to 512MB
- Add "memory_limit": "512M", into above line of "user": "nginx" in config in php section.
- Run both of above "Commands after edit file".
- After complete run, add /var/www/vhosts/YOUR-DOMAIN/phpinfo.php which contains <?php phpinfo(); ?> then access and confirm changes.
- Never forget to remove phpinfo.php file after confirm.
Configuration Sample
{
"nginx": {
"config": {
"user": "nginx"
}
},
"php": {
"config": {
"memory_limit": "512M",
"user": "nginx"
}
},
"run_list": [
"recipe[amimoto]"
]
}
Changing upload_max_filesize
Change upload_max_filesize to 30MB
- Add "client_max_body_size": "30M", to config in nginx section.
- Add "upload_max_filesize": "30M", to config in php section.
- Run both of above "Commands after edit file".
- After complete run, add /var/www/vhosts/YOUR-DOMAIN/phpinfo.php which contains <?php phpinfo(); ?> then access and confirm changes.
- Never forget to remove phpinfo.php file after confirm.
Configuration Sample
{
"nginx": {
"config": {
"client_max_body_size": "30M",
"user": "nginx"
}
},
"php": {
"config": {
"upload_max_filesize": "30M",
"user": "nginx"
}
},
"run_list": [
"recipe[amimoto]"
]
}
Change max_allowed_packet
To Change max_allowed_packet to 16MB
- Add "max_allowed_packet": "16M", to config in mysql section. If you cannot find mysql section, add it like the following configuration sample.
- Run both of above "Commands after edit file"
- Run following mysql command and confirm changes.
mysql> show variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name | Value |
+--------------------+----------+
| max_allowed_packet | 16777216 |
+--------------------+----------+
1 row in set (0.03 sec)
mysql> exit
Bye
Configuration Sample
{
"nginx": {
"config": {
"user": "nginx"
}
},
"php": {
"config": {
"user": "nginx"
}
},
"mysql": {
"config": {
"max_allowed_packet": "16M"
}
},
"run_list": [
"recipe[amimoto]"
]
}