Learn about Centmin Mod LEMP Stack today
Register Now

Akeneo PIM with Nginx and PHP 7 on Lemp Stack Centmin Mod

Discussion in 'Ecommerce / Shopping cart usage' started by ljseals, Mar 20, 2017.

  1. ljseals

    ljseals Member

    Dec 20, 2016
    Local Time:
    1:33 AM
    Greetings, Akeneo is Product Information Management (PIM) which is a system that centralizes and harmonizes all your marketing and technical information for product listings and catalogs. It currently integrates well with Magento. Through the help of the Lord I was able to get this installed on Centmin Mod using Nginx and PHP 7.0.16, it has took a very long time but here is a version that is successfully installed. I will not go over integrating it with magento only to install it on Centmin Mod.

    More information here: What is a PIM - Akeneo - The Open Source PIM

    Please note for the majority of E commerce Websites using a PIM solution may be a little extreme.

    Install composer Globally
    Code (Text):
    curl -sS https://getcomposer.org/installer | php
    sudo mv composer.phar /usr/local/bin/composer

    Install APCU Cache for PHP 7
    Code (Text):
    cd /svr-setup
    git clone https://github.com/krakjoe/apcu
    cd apcu
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install

    Code (Text):
    touch ${CONFIGSCANDIR}/apcu.ini
    cat > "${CONFIGSCANDIR}/apcu.ini" <<EOF

    Enable File Info

    set in persistent config file /etc/centminmod/custom_config.inc
    Code (Text):

    Recompile PHP Setting using the PHP 7.0.16
    Code (Text):
    Centmin call
    Option 5
    PHP 7.0.16 

    Create your V-Host using the Centmin Menu Option 2 (
    Add Nginx vhost domain) or by using the Let's Encypt Acme tool.
    Code (Text):
    cd /usr/local/src/centminmod/addons/
    Also create a Mysql Database and User.

    Code (Text):
    cd /usr/local/src/centminmod/addons/
    ./mysqladmin_shell.sh setuserdb

    I have chosen to use the subdomain pim.domain.com but you may choose what you like as the subdomain.

    Modify Vhost
    Code (Text):
    nano /usr/local/nginx/conf/conf.d/pim.domain.com.ssl.conf

    Code (Text):
    server {
      server_name pim.domain.com www.pim.domain.com;
      return 302 https://$server_name$request_uri;
    server {
      listen 443 ssl http2;
      server_name pim.domain.com www.pim.domain.com;
      include /usr/local/nginx/conf/ssl/pim.domain.com/pim.domain.com.crt.key.conf;
      include /usr/local/nginx/conf/ssl_include.conf;
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # mozilla recommended
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
      # enable ocsp stapling
      resolver valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
      # limit_conn limit_per_ip 16;
      # ssi  on;
      access_log /home/nginx/domains/pim.domain.com/log/access.log main_ext buffer=256k flush=60m;
      error_log /home/nginx/domains/pim.domain.com/log/error.log;
      include /usr/local/nginx/conf/autoprotect/pim.domain.com/autoprotect-pim.domain.com.conf;
      root /home/nginx/domains/pim.domain.com/public/web;
        rewrite     ^/(app|app_dev)\.php/?(.*)$ /$1 permanent;
        location / {
            index       app.php;
            try_files   $uri @rewriteapp;
        location @rewriteapp {
            rewrite     ^(.*)$ /app.php/$1 last;
      #include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php_pim.conf;
      include /usr/local/nginx/conf/drop.conf;
      include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;

    Modify PHP .CONF
    make a copy of /usr/local/nginx/conf/php.conf named /usr/local/nginx/conf/php_pim.conf via ssh command line type

    Code (Text):
    cp -a /usr/local/nginx/conf/php.conf /usr/local/nginx/conf/php_pim.conf

    Edit the document by replacing the code below.
    Code (Text):
    nano /usr/local/nginx/conf/php_pim.conf

    Code (Text):
    location ~ ^/app\.php(/|$) {
      include /usr/local/nginx/conf/503include-only.conf;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        #fastcgi_pass   unix:/tmp/php5-fpm.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
        #fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/;

    Modify PHP Settings
    Code (Text):
     nano /etc/centminmod/php.d/b_customphp.ini

    My settings
    Code (Text):
    date.timezone = UTC
    max_execution_time = 160
    short_open_tag = Off
    realpath_cache_size = 640k
    realpath_cache_ttl = 86400
    upload_max_filesize = 800M
    memory_limit = 4096M
    post_max_size = 800M
    expose_php = Off
    mail.add_x_header = Off
    max_input_nesting_level = 128
    max_input_vars = 10000
    mysqlnd.net_cmd_buffer_size = 16384

    You may want to adjust the memory_limit 1024M but you can go lower if need be to 512M.

    Change directory and Install Akeneo via Composer
    This depends on your preference but I like my application to sit in the root directory.
    Code (Text):
    cd /home/nginx/domains/pim.domain.com/
    composer create-project --prefer-dist akeneo/pim-community-standard ./pim-project "1.7.*@stable"

    During Composer install you will have to enter your database information that composer set up earlier. Change the folder name from pim-project to public the:
    Code (Text):
    chown -R nginx:nginx /home/nginx/domains/pim.domain.com/public

    Finish Installation
    Code (Text):
    cd /home/nginx/domains/pim.domain.com/public
    composer install --optimize-autoloader --prefer-dist
    php app/console cache:clear --env=prod
    php app/console pim:install --env=prod
    chown -R nginx:nginx /home/nginx/domains/pim.domain.com/public

    Visit pim.domain.com and you should get the login screen with the default password being admin/admin. Finish install by going to Installing Akeneo PIM Community Edition (CE) with the Archive — Akeneo PIM documentation to finish configuring the site. Please also note that NGINX is not officially supported. It took me a long while but through the Lord's help I was able to install Akeneo! :) God bless you!
    Last edited: Mar 20, 2017
  2. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    5:33 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    very very nice @ljseals and thanks for sharing :)

    Great to see when fellow users share their guides and experiences :D