Want to subscribe to topics you're interested in?
Become a Member

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

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    9:22 PM
    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
    https://community.centminmod.com/th...caching-with-php-zend-opcache.101/#post-34070
    Code (Text):
    cd /svr-setup
    git clone https://github.com/krakjoe/apcu
    cd apcu
    /usr/local/bin/phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install


    Code (Text):
    CONFIGSCANDIR='/etc/centminmod/php.d'
    touch ${CONFIGSCANDIR}/apcu.ini
    
    cat > "${CONFIGSCANDIR}/apcu.ini" <<EOF
    extension=apcu.so
      apc.enabled=1
      apc.shm_size=256M
      apc.ttl=7200
      apc.enable_cli=1
      apc.gc_ttl=3600
      apc.entries_hint=4096
      apc.slam_defense=1
      apc.serializer=igbinary
    EOF
    
    fpmrestart



    Enable File Info

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


    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/
    ./acmetool.sh
    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):
    #x# HTTPS-DEFAULT
    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_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+ECDSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+SHA384:EECDH+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA$
      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 8.8.8.8 8.8.4.4 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   127.0.0.1:9000;
        #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
    always_populate_raw_post_data=-1
    


    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

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:22 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    very very nice @ljseals and thanks for sharing :)

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