Postfix sender_dependent_default_transport_maps per domain outgoing IP

Postfix allows to route mails through specific IPs depending on a senders domain or email address.
This is achieved through sender_dependent_default_transport_map.
Suppose we have 3 domains and we want to assign independent outgoing IP address for each of them.
Lets create 3 different transport for them in master.cf

Continue reading “Postfix sender_dependent_default_transport_maps per domain outgoing IP”

Putting Magento 2 in maintenance mode

We often have to put our sites in maintenance. If our sites run Magento 2 we can this in traditional method i.e using htaccess file and rewrite rules. But there is also a simpler way to do this.

With Magento 2 we do not have to fiddle with htaccess or rewrite rules. We can do this with a simple command

Continue reading “Putting Magento 2 in maintenance mode”

Postfix DKIM signing

Having emails signed with DKIM has become important. DKIM ensure that the mail is not tampered during the transit and also the authenticity of the source.

Adding DKIM support to sign outgoing mail in Postfix is quite easy. We need to install opendkim packages, on Ubuntu run

apt-get install opendkim-tools opendkim
Continue reading “Postfix DKIM signing”

MySQL 5.7 Reset root password

With mysql 5.7 the mysql.user table do not have the Password column, it has been replaced by the authentication_string column. Another notable difference is the plugin column, which allows for different authentication methods.

In Ubuntu 18.04 LTS and later release the default authentication plugin/method for root user is auth_socket. This plugin uses the SO_PEERCRED socket option to obtain information about the user running the client program. If the mysql client is ran by root user it will be authenticated and granted root privileges. There is no password required.

We can change this and revert to the native password authentication method. To do this restart the mysql server with skip-grant-tables option like

Continue reading “MySQL 5.7 Reset root password”

Redirect HTTP to HTTPS

Its important to have your site running with HTTPS i.e secure HTTP connection.
It helps in securing your site as well as SEO point of view.

If we have root access to your server and can edit Apache configuration file the the simplest method is to add below lines to your virtualhost configuration.

Continue reading “Redirect HTTP to HTTPS”

Running PHP-FPM with Apache2.4/mod_proxy_fcgi

Apache2.4 does not support mod_fastcgi, the alternate option is to run php-fpm with mod_proxy_fcgi.

On Ubuntu you need to enable mod_proxy and mod_proxy_fcgi.

a2enmod mod_proxy mod_proxy_fcgi

We can now configure apache to run php-fpm as below

Continue reading “Running PHP-FPM with Apache2.4/mod_proxy_fcgi”

Running multiple MySql servers with mysqld_multi

Concept

Sometime there are are situations when we require to run multiple MySql servers on same server for example, two group of developers working on separate projects where they may need to have database with different setting for e.g sql_mode or innodb-file-format or any others.
We can either install separate MySQL servers or they make use of mysqld_multi, which has advantage of installing a single version of MySQL package and running/managing them all with mysqld_multi utility.

Steps to setup

Continue reading “Running multiple MySql servers with mysqld_multi”