1. Amimoto Help Center
  2. Amimoto AMI
  3. Getting Started with Amimoto-AMI

4. Managing AMIMOTO Config

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

  1. Add "memory_limit": "512M", into above line of "user": "nginx"  in config in php section.
  2. Run both of above "Commands after edit file".
  3. After complete run, add /var/www/vhosts/YOUR-DOMAIN/phpinfo.php  which contains  <?php phpinfo(); ?> then access and confirm changes.
  4. 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

  1. Add  "client_max_body_size": "30M",  to config in nginx section.
  2. Add "upload_max_filesize": "30M",  to config in php section.
  3. Run both of above "Commands after edit file".
  4. After complete run, add /var/www/vhosts/YOUR-DOMAIN/phpinfo.php   which contains  <?php phpinfo(); ?>  then access and confirm changes.
  5. 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

  1. Add "max_allowed_packet": "16M",  to config in mysql section. If you cannot find mysql section, add it like the following configuration sample.
  2. Run both of above "Commands after edit file"
  3. 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]"
  ]
}