When running a Magento site, giving the right attention to the server environment is a must. Magento is a resource intensive application, so making sure it runs fast enough is vital for your business. This guide is not about the procedures to reach best performance, but which tools are needed to make this possible in the first place.

Run Magento on Linux, not Windows

Seriously. Do not run Magento on Windows. While PHP has been optimized over the years to perform well under IIS, many other Magento dependancies do not (MySQL, Redis, memcache). Do not run Magento on Windows. Besides Linux, a BSD variant is also a good option (OpenBSD, FreeBSD, NetBSD). Note that whatever you run on the client side (so your own computer at work or at home) is of less importance here.

Webserver and stuff

We favor Nginx over Apache. This is a personal choice, because both servers allow for reaching the same performance - Nginx simply makes this easier, in our opinion. If your site becomes busy, do not use mod_php or something similar - use PHP-FPM instead. Consider replacing MySQL with MariaDB. Make sure to have cool PHP tools like Zend OPC, xdebug and memcache enabled. Also add Redis to the stack. Keep up to date with PHP - for instance, PHP 5.4 is faster than PHP 5.3.

Do not use FTP. Use SSH instead.

Do not use FTP. Use SSH instead. With FTP, all data - including login credentials - are sent over the network in plain text, ready for any hacker to fetch them. SSH brings you a safe alternative. SSH also offers you an interactive shell: This makes various Magento tasks a lot easier. For instance, copying a Magento site through FTP is a complete nightmare: Thousands of files are transferred one at a time, without much guarantee that all files are transferred correctly. Additionally timeouts might occur in some environments. With SSH this can be bypassed by first creating an archive (tar or zip) and then transferring that archive instead.

Similarly, importing databases is not a task for a tool like phpMyAdmin. It might work with a database of 10Mb in size. However, it will definitely not work with databases larger than 1Gb (medium Magento shop). SSH is simply a requirement when running Magento.

To give third party developers access through SSH, you can give them your SSH account and password, and reset the password once they're done. Alternatively, create new developer accounts and ask them to use sudo to become the needed account (root, webserver).

SSH as root

If you do not have access to your own server as root, your hosting provider probably has. This means that you are completely dependant of your hoster, when the shit hits the fan. Having root access will allow you to fix things yourself or hire a developer to do this for you. Make sure to be careful with giving your root password to third party developers. Having too many people maintain your Linux configuration will make a mess.

Git & ticketing

Run your entire Magento site through git or a similar version control system (Mercurial, CVS). Either use a repository provider (GitHub, Assembla, BitBucket) or host your own repositories. Also, make sure you have a proper ticketing system in place. A possible solution is to use one of the ticketing systems of the Git provider (GitHub, Assembla, BitBucket) or alike (Basecamp), or use a specialized ticketing system (ZenDesk, Trello).

Magento command-line tools

Install composer and n98-magerun on your server. Make yourself familiar with common magerun tasks like cleaning the cache, scanning for XML rewrite conflicts and indexing. Additionally, consider using modman for installing extensions.

Basic Linux tools

Make sure to have basic tools installed like vim (better than just vi), lockrun (for running longer tasks), locate / updatedb (for locating files easily). Also consider diving into performance tools. Every Linux admin should know tools like top, free and iostat. Additionally, lsof, htop and atop are examples of tools to have installed as well.

Posted on October 4, 2014

About the author

Author Jisse Reitsma

Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.

Sponsor Yireo

Upcoming events

Oct
28
Oct
31
LIEF Amsterdam

Looking for a training in-house?

Let's get to it!

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.

Do not miss out on what we say

This will be the most interesting spam you have ever read

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.