- Download the magento 2.3 with sample data from this link: https://magento.com/tech-resources/download
I download the file Magento-CE-2.3.0_sample_data-2018-11-27-10-26-20.tar.bz2 - Extract the zip or tar.bz2 file to the web root. I extract the file into mce230 directory
- Check the php version (CLI and PHP-FPM). Make sure php version is 7.2
123456teddy@teddy:~$ php -vPHP 7.0.33-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Dec 7 2018 08:27:52) ( NTS )Copyright (c) 1997-2017 The PHP GroupZend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologieswith Zend OPcache v7.0.33-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologieswith Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans
change it to php 7.2
1teddy@teddy:~$ sudo ln -sfn /usr/bin/php7.2 /etc/alternatives/php
check again
123456teddy@teddy:~$ php -vPHP 7.2.14-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jan 13 2019 10:05:18) ( NTS )Copyright (c) 1997-2018 The PHP GroupZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologieswith Zend OPcache v7.2.14-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologieswith Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans
Also check the php-fpm version: http://localhost:8080/phpinfo.php
If not php 7.2, change it like this:
1teddy@teddy:~$ sudo gedit /etc/nginx/sites-available/default
Modify to enable php7.2-fpm
12345678910111213141516171819202122server {listen 8080 default_server;listen [::]:8080 default_server;...# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~ \.php$ {include snippets/fastcgi-php.conf;## # With php7.0-cgi alone:# fastcgi_pass 127.0.0.1:9000;# # With php7.0-fpm:fastcgi_pass unix:/run/php/php7.2-fpm.sock; #ENABLE# fastcgi_pass unix:/run/php/php7.0-fpm.sock;# fastcgi_pass unix:/run/php/php5.6-fpm.sock;}...}...
Then save and restart nginx server.
check again the php-fpm version: http://localhost:8080/phpinfo.php
Now it’s PHP Version 7.2.14-1+ubuntu16.04.1+deb.sury.org+1
NOTE: I foundSOME EXTENSIONS ARE MISSING. SO INSTALL THEM
1sudo apt-get install php7.2-bcmath php7.2-soap
- Create the config file
1teddy@teddy:~$ sudo gedit /etc/nginx/sites-available/mce230.test
Here is the content:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206server {listen 80;server_name mce230.test;set $MAGE_ROOT /home/teddy/Documents/works/mce230;root $MAGE_ROOT;index index.php;autoindex off;charset UTF-8;error_page 404 403 = /errors/404.php;#add_header "X-UA-Compatible" "IE=Edge";client_max_body_size 100M;# PHP entry point for setup applicationlocation ~* ^/setup($|/) {root $MAGE_ROOT;location ~ ^/setup/index.php {fastcgi_split_path_info ^(.+?\.php)(/.*)$;fastcgi_buffers 1024 4k;fastcgi_read_timeout 600s;fastcgi_connect_timeout 600s;fastcgi_pass unix:/run/php/php7.2-fpm.sock; #FOR AWS SERVER#fastcgi_pass 127.0.0.1:9000;#fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}location ~ ^/setup/(?!pub/). {deny all;}location ~ ^/setup/pub/ {add_header X-Frame-Options "SAMEORIGIN";}}# PHP entry point for update applicationlocation ~* ^/update($|/) {root $MAGE_ROOT;location ~ ^/update/index.php {fastcgi_split_path_info ^(/update/index.php)(/.+)$;fastcgi_pass unix:/run/php/php7.2-fpm.sock; #FOR AWS SERVER#fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param PATH_INFO $fastcgi_path_info;include fastcgi_params;}# Deny everything but index.phplocation ~ ^/update/(?!pub/). {deny all;}location ~ ^/update/pub/ {add_header X-Frame-Options "SAMEORIGIN";}}location / {try_files $uri $uri/ /index.php?$args;}location /pub/ {location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {deny all;}alias $MAGE_ROOT/pub/;add_header X-Frame-Options "SAMEORIGIN";}location ~ ^/pub/static/version {rewrite ^/pub/static/(version\d*/)?(.*)$ /pub/static/$2 last;}location /static/ {# Uncomment the following line in production mode# expires max;# Remove signature of the static files that is used to overcome the browser cachelocation ~ ^/static/version {rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;}location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {add_header Cache-Control "public";add_header X-Frame-Options "SAMEORIGIN";expires +1y;if (!-f $request_filename) {rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;}}location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {add_header Cache-Control "no-store";add_header X-Frame-Options "SAMEORIGIN";expires off;if (!-f $request_filename) {rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;}}if (!-f $request_filename) {rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;}add_header X-Frame-Options "SAMEORIGIN";}location /media/ {try_files $uri $uri/ /get.php?$args;location ~ ^/media/theme_customization/.*\.xml {deny all;}location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {add_header Cache-Control "public";add_header X-Frame-Options "SAMEORIGIN";expires +1y;try_files $uri $uri/ /get.php?$args;}location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {add_header Cache-Control "no-store";add_header X-Frame-Options "SAMEORIGIN";expires off;try_files $uri $uri/ /get.php?$args;}add_header X-Frame-Options "SAMEORIGIN";}location /media/customer/ {deny all;}location /media/downloadable/ {deny all;}location /media/import/ {deny all;}# PHP entry point for main applicationlocation ~ (index|get|static|report|404|503)\.php$ {try_files $uri =404;fastcgi_pass unix:/run/php/php7.2-fpm.sock; #FOR AWS SERVER#fastcgi_pass 127.0.0.1:9000;fastcgi_buffers 1024 4k;fastcgi_read_timeout 600s;fastcgi_connect_timeout 600s;# to configure profiler in Magento 2fastcgi_param MAGE_PROFILER html;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;#include fastcgi_params;#FOR DEVELOPMENT MODE ONLY - BEGINfastcgi_param MAGE_IS_DEVELOPER_MODE true;fastcgi_param PHP_VALUE display_startup_errors=on;fastcgi_param PHP_VALUE display_errors=on;fastcgi_param PHP_VALUE html_errors=on;fastcgi_param PHP_VALUE log_errors=on;fastcgi_param PHP_VALUE error_log=/home/teddy/Documents/works/mce230/var/log/system.log;#FOR DEVELOPMENT MODE ONLY - ENDinclude fastcgi_params;#FOR DEBUGGING WITH XDEBUG - BEGIN#fastcgi_read_timeout 600;#FOR DEBUGGING WITH XDEBUG - END}gzip on;gzip_disable "msie6";gzip_comp_level 6;gzip_min_length 1100;gzip_buffers 16 8k;gzip_proxied any;gzip_typestext/plaintext/csstext/jstext/xmltext/javascriptapplication/javascriptapplication/x-javascriptapplication/jsonapplication/xmlapplication/xml+rssimage/svg+xml;gzip_vary on;# Banned locations (only reached if the earlier PHP entry point regexes don't match)location ~* (\.php$|\.htaccess$|\.git) {deny all;}}
- Enable file config
1teddy@teddy:~$ sudo ln -s /etc/nginx/sites-available/mce230.test /etc/nginx/sites-enabled/mce230.test
- Register the host on my system
1sudo gedit /etc/hosts
Like this:
123...127.0.0.1 mce230.test...
- CHECK THE NGINX SETTING AND RESTART IT:
12345teddy@teddy:~$ sudo nginx -tnginx: [warn] conflicting server name "" on 0.0.0.0:80, ignorednginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: configuration file /etc/nginx/nginx.conf test is successfulteddy@teddy:~$ sudo service nginx restart
- Set file permission and owner:
1234567teddy@teddy:~/Documents/works/mce230$ sudo suroot@teddy:/home/teddy/Documents/works/mce230# find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;root@teddy:/home/teddy/Documents/works/mce230# find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;root@teddy:/home/teddy/Documents/works/mce230# chown -R :www-data .root@teddy:/home/teddy/Documents/works/mce230# chmod u+x bin/magentoroot@teddy:/home/teddy/Documents/works/mce230# exitexit
Then
12teddy@teddy:~/Documents/works/mce230$ sudo chown www-data -R var/ pub/ app/etc/ setup/ generated/teddy@teddy:~/Documents/works/mce230$ sudo chmod -R 777 var/ pub/ app/etc/ setup/ generated/
- Run the first installation: http://mce230.test
It’d be redirected to http://mce230.test/setup/#/landing-install
NOTE: Don’t forget to create a new database ‘mce230’ with utf8-general-ci via phpmyadmin (http://phpmyadmin.test:8080)
OK. So here is My Store Address : http://mce230.test/
and Magento Admin Address: http://mce230.test/admin_cereoy
NOTE: Don’t forget to compile after finishing the installation. If not, you’d get the ugly page.
|
1 2 |
teddy@teddy:~/Documents/works/mce230$ sudo su -s /bin/bash www-data www-data@teddy:/home/teddy/Documents/works/mce230$ php bin/magento setup:upgrade --keep-generated && php bin/magento setup:di:compile && php bin/magento setup:static-content:deploy -f --language en_AU --language en_US && php bin/magento indexer:reindex && php bin/magento cache:clean && php bin/magento cache:flush |
DONE
BUGS:
Sometimes the product images can’t be displayed! I tried to recompile with all the above commands but no avail
Solution: I need to resize the product images
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
www-data@teddy:/home/teddy/Documents/works/mce230$ php bin/magento catalog:image:resize 1/3422 [>---------------------] 0% < 1 sec 66.2 MiB | /m/b/mb01-blue 3/3422 [>----------------] 0% 2 secs 66.2 MiB | /m/b/mb04-black-0_alt1 5/3422 [>----------------] 0% 3 secs 66.2 MiB | /m/b/mb03-black-0_alt1 15/3422 [>----------------] 0% 12 secs 66.2 MiB | /w/b/wb06-red-0_alt1.j 21/3422 [>----------------] 0% 18 secs 66.2 MiB | /u/g/ug07-bk-0_alt1.jp 26/3422 [>----------------] 0% 22 secs 66.2 MiB | /l/u/luma-yoga-brick.j 27/3422 [>----------------] 0% 22 secs 66.2 MiB | /l/u/luma-foam-roller. 29/3422 [>--------] 0% 24 secs 66.2 MiB | /l/u/luma-stability-ball-gray. 30/3422 [>--------] 0% 25 secs 66.2 MiB | /l/u/luma-stability-ball-pink. 456/3422 [=>-------] 13% 6 mins 66.2 MiB | /w/h/wh08-white_alternate_1.jp 500/3422 [=>-------] 14% 7 mins 66.2 MiB | /w/j/wj04-white_alternate_1.jp 801/3422 [==>------] 23% 11 mins 66.2 MiB | /w/s/wsh12-red_main_1.jpg Product images resized successfully |
I think no need to wait until 100% to resize the images! because it’d take a long time. just refresh the page if you think if the process is already pretty long
TO DISABLE THE CODE PROFILER ON THE M2 PAGE, MODIFY THE NGINX FILE (sudo gedit /etc/nginx/sites-available/mce230.test) THEN SET:
|
1 |
#fastcgi_param MAGE_PROFILER html; |
THEN RESTART NGINX SERVER: sudo service nginx reload