Summarize Magento install configuration

In here is some touch points for standardize Magento install configuration to prepare for subscription packages.

<> Configure SWAP for Linux

Because, SWAP will use hard drive for enhance memory, so that, we have to choose carefully to restrict impact to total storage of our sites
Suggestion: 4GB SWAP / 20 GB SSD, 8GB SWAP / 40 GB SSD

$ sudo fallocate -l 4G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ sudo sysctl -w vm.max_map_count=262144

<> Configure PHP for enhance limitation

We can change php.ini followed by OS

Ubuntu

$ sudo {vim|nano} /etc/php/{7.2|7.3}/apache2/php.ini

CentOS / Amazon Linux 2

$ sudo {vim|nano} /etc/php.ini

Change some value in php.ini to enhance

max_execution_time = 300
post_max_size = 100M
upload_max_filesize = 100M
memory_limit = 768M

<> Configure Apache virtual host for preparing SSL

Ubuntu

$ sudo {vim | nano} /etc/apache2/sites-enabled/default

CentOS / Amazon Linux 2

$ sudo {vim | nano} /etc/httpd/conf.d/{site_name}.conf

We can use content like below

<VirtualHost *:80>
   <Directory /var/www/html>
      AllowOverride All
      Require all granted
      Options Indexes FollowSymLinks
      DirectoryIndex index.php index.html index.htm
   </Directory>
</VirtualHost>

<> Configure SSL for site using Apache

sudo certbot --apache -d {site_name}

<> Configure MariaDB

By default, root password is not set and normal system user can login directly with blank password

$ sudo mysql -uroot -p

But , we have to secure them through instructions

mysql_secure_installation

After that, we will configure accounts for Mageno

Login with root account
mariadb shell > create user 'magento_user'@'localhost' identified by 'magento_user_pwd';
mariadb shell > create database magento_db;
mariadb shell > grant all privileges on 'magento_db'.* to 'magento_user'@'localhost';
mariadb shell > flush privileges;
Log out

After all these steps, we have to store all information securely

3 Likes