Posts

How to install Varnish cache in centos 7

Varnish is a proxy server focused on HTTP caching. It’s designed as an HTTP accelerator and can act as reverse proxy for your web server Apache or Nginx. Varnish has been used for high-profile and high-traffic websites.

Step 1 : install apache from centos repository :

yum -y install httpd
we enable and start apache :
systemctl start httpd
systemctl enable httpd

Step 2 : Configure Apache on port 8080 :

vi /etc/httpd/conf/httpd.conf

Change the default port 80 to 8080 on the ‘Listen’ line.

Listen 8080

Save and Exit!

apachectl configtest
systemctl restart httpd

Step 3 – Install Varnish on CentOS 7 :

yum -y install epel-release
yum -y install varnish
systemctl start varnish
systemctl enable varnish

Step 4 – Configure Varnish as a reverse proxy for Apache :

Magento 2 change city input to select

In this topic we will create a magento 2 module which can change city input type to select
First of all, we will create a module files :
1- Create these folders :
app/code/Seonov
app/code/Seonov/Customcheckout

the Seonov folder is the module namespace and customcheckout is the module name.

2- Now we need to create a module.xml file in app/code/Seonov/Customcheckout/etc/ with the current content :

app/code/Seonov/Customcheckout/etc/module.xml



    

3- To register the module we need to create a registration.php file in app/code/Seonov/Customcheckout/ with the following code :



 


                  $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
                  ['shippingAddress']['children']['shipping-address-fieldset']['children']['city'] = [
                      'component' => 'Magento_Ui/js/form/element/select',
                      'config' => [
                          'customScope' => 'shippingAddress',
                          'template' => 'ui/form/field',
                          'elementTmpl' => 'ui/form/element/select',
                      ],
                      'dataScope' => 'shippingAddress.city',
                      'label' => 'Ville',
                      'provider' => 'checkoutProvider',
                      'visible' => true,
                      'validation' => [],
                      'sortOrder' => 80,
                      'id' => 'city',
                      'options' => [
                          [
                              'value' => '',
                              'label' => 'Choose a city',
                          ],
                          [
                              'value' => 'citycode',
                              'label' => 'cityname',
                          ]
                      ]
                  ];
              
        return $jsLayout;

5-Finally we need to register out block by creating a file di.xml inside app/code/Seonov/Customcheckout/etc/ with the following code :



    
        
    

after upgrading setup “php bin/magento setup:upgrade” and “php bin/magento di:compile” the checkout city input will be select!
Enjoy!