fbpx

Magento 2 / NGINX

Magmi for Magento 2. Installation and NGINX configuration

by , , revisited on


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

What is Magmi

Magmi is a Magento Mass Importer developed as a Magento DATABASE client, (ie not a Magento extension), that operates directly in SQL and is the result of a deep analysis of the Magento Database Model. The first Magmi goal was catalog import & update.

Install Magmi for Magento 2

Installation via composer is preferred to facilitate easy upgrades:

composer install macopedia/magmi2

Now, you have to configure it with the same database credentials as Magento 2:

cp vendor/macopedia/magmi2/magmi/conf/magmi.ini.default vendor/macopedia/magmi2/magmi/conf/magmi.ini
nano vendor/macopedia/magmi2/magmi/conf/magmi.ini
# Set the proper database values in the editor

For Composer-based installation, ensure the following setting value:

basedir="../../../../.."

NGINX configuration for Magmi

Download and put Magmi source files to your Magento directory, not into pub directory!

Following that, use the following config:

location /magmi/ {
    auth_basic off;
    alias /srv/www/example.com/vendor/macopedia/magmi2/magmi/web/;
    location ~ \.php$ {
        fastcgi_pass   unix:/var/run/php-fpm/php-fpm-example.com.sock;
        fastcgi_index  index.php;
        # fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        # $request_filename makes more sense in combination with alias
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
        fastcgi_param  PHP_VALUE "memory_limit=2G \n max_execution_time=3600";
        fastcgi_read_timeout 3600s;
        fastcgi_connect_timeout 3600s;
        include fastcgi_params;
    }
}

Ensure the proper path to your Magento 2 installation by changing path /srv/www/example.com.
Also, adjust the path to the .sock file to match your PHP-FPM configuration.

Now you can access https://example.com/magmi/magmi.php.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: