$ mkdir ~/docker_workspace
$ cd ~/docker_workspacedocker run -p 8080:80 -p 3306:3306 -p 8000:8000 --cpuset-cpus="0-3" --name ubuntu-magento -w $PWD -it -v $PWD:$PWD ubuntu:18.04- port 8080: magento site
- port 3306: mysql server
- port 8000: phpmyadmin
$ apt-get update
$ apt-get -y install nano software-properties-common
$ add-apt-repository ppa:ondrej/php
$ apt-get update
$ apt install -y php7.3 libapache2-mod-php7.3 php7.3-common php7.3-gmp php7.3-curl php7.3-soap php7.3-bcmath php7.3-intl php7.3-mbstring php7.3-xmlrpc php7.3-mysql php7.3-gd php7.3-xml php7.3-cli php7.3-zip
$ apt-get -y install php7.3-fpm
$ nano /etc/php/7.3/fpm/php.inipress ctrl + w for searching
memory_limit = 2G
max_execution_time = 3600
max_input_time = 1800
max_input_vars = 10000
upload_max_filesize = 128M
zlib.output_compression = On
press ctrl + O for saving.$ service php7.3-fpm start$ apt-get install -y mysql-server
$ service mysql start
$ mysql_secure_installationVALIDATE PASSWORD PLUGIN
Press y|Y for Yes, any other key for No: y
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y$ mysql -u root -p
(pass: root)mysql> DROP USER 'root'@'localhost';
mysql> uninstall plugin validate_password;
mysql> CREATE USER 'root'@'%' IDENTIFIED BY '';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> exit;Now try to connect again:
mysql -u root==> If don't require pass, It's OK
$ apt-get -y install nginx
$ rm /etc/nginx/sites-enabled/defaulthttps://magento.com/tech-resources/download
Copy Magento-CE-2.3.4_sample_data-2020-01-22-11-11-58.tar.gz to ~/docker_workspace
$ mkdir /var/www/html/magento
$ tar -zxvf Magento-CE-2.3.4_sample_data-2020-01-22-11-11-58.tar.gz -C /var/www/html/magento
$ chown -R www-data:www-data /var/www/html/magento
$ chmod -R 755 /var/www/html/magento$ nano /etc/nginx/sites-available/magentoCopy magento.conf and paste to this file
$ ln -s /etc/nginx/sites-available/magento /etc/nginx/sites-enabled/
$ nginx -t
$ service nginx reload$ mysql -u root -pmysql> create database magento;
mysql> exit;- shop.example.com : this is my example domain
$ sudo nano /etc/nginx/sites-available/shop.example.comCopy shop.example.com and paste to this file
$ sudo ln -s /etc/nginx/sites-available/shop.example.com /etc/nginx/sites-enabled/
$ sudo nginx -t
$ sudo service nginx reloadOpen browser: http://localhost:8080
If deploy production server Open browser: http://shop.example.com
$ apt install -y phpmyadminConfigure database for phpmyadmin with dbconfig-common? [yes/no] yes
(Enter the items you want to select, separated by spaces.)
(space and enter)*** During the installation, it will prompt you to select a web server to configure. Nginx isn’t in the list, so press the Tab key and hit OK to skip this step.
$ mysql -u rootmysql> show grants for phpmyadmin@localhost;
+--------------------------------------------------------------------+
| Grants for phpmyadmin@localhost |
+--------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'phpmyadmin'@'localhost' |
| GRANT ALL PRIVILEGES ON `phpmyadmin`.* TO 'phpmyadmin'@'localhost' |
+--------------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> exit;
Bye$ nano /etc/nginx/sites-available/phpmyadminCopy phpmyadmin.conf and paste to this file
$ ln -s /etc/nginx/sites-available/phpmyadmin /etc/nginx/sites-enabled/
$ nginx -t
$ service nginx reloadopen http://localhost:8000/$ nano /etc/phpmyadmin/config.inc.phpFind the line:
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;Uncomment that line; you’ll remove the //.
$ docker commit -p ubuntu-magento magento2-nginx-ubuntu$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE
magento2-nginx-ubuntu latest f6a3f0e82628 9 seconds ago 1.76GB$ docker save -o magento2-nginx-ubuntu.tar magento2-nginx-ubuntu$ docker load -i magento2-nginx-ubuntu.tar
$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE
magento2-nginx-ubuntu latest f6a3f0e82628 9 seconds ago 1.76GB$ service --status-all$ service php7.3-fpm restart
$ service nginx restart
$ service mysql restart$ nano ~/.bashrcAdd below content to this file
service php7.3-fpm restart
service nginx restart
service mysql restartuse the following SQL query on the MySQL console or in a client like phpMyAdmin:
open http://localhost:8000/DELETE FROM core_config_data WHERE path='web/cookie/cookie_domain';
DELETE FROM core_config_data WHERE path='web/cookie/cookie_path';$ cd /var/www/html/magento
$ rm -rf var/cache var/page_cache var/view_processed
$ php bin/magento setup:di:compile
$ php bin/magento cache:clean
$ php bin/magento cache:flush
$ chown -R www-data:www-data /var/www/html/magento
$ chmod -R 755 /var/www/html/magento$ nano /etc/php/7.3/fpm/php.inipress ctrl + w for searching
max_input_vars = 10000press ctrl + O for saving.










