Hosting WordPress Yourself Part 2 – Installing Nginx, PHP and MariaDB

Updated on Feb 22, 2017.

In Part 1 of this series on Hosting WordPress Yourself, I took you through the initial steps to setting up and securing a virtual server. In this post I will guide you through the process of setting up Nginx, PHP-FPM and MariaDB, which will form the foundations of a working web server.

Before moving on, you will need to open a new SSH connection to the server, if you haven’t already:


Installing Nginx

Although the Ubuntu package manager (apt-get) has access to Nginx packages, they’re often outdated and only give you access to the stable branch. It’s recommended that most servers run the mainline version, which receives move regular updates (including minor bug fixes and new features). This article explains the difference between the two branches in more detail, but generally speaking, if you don’t plan on using any third party Nginx modules the mainline branch is the way to go.

First add the repository containing the mainline version and update the package lists:

sudo add-apt-repository ppa:nginx/development -y
sudo apt-get update

Then install the package:

sudo apt-get install nginx -y

Once complete, you can confirm that Nginx has been installed with the following command:

nginx -v

Additionally, when visiting your server’s Fully Qualified Domain Name (FQDN) in the browser, you should see an Nginx welcome page.

Welcome to nginx

Now that Nginx has successfully installed it’s time to perform some basic configuration. Out of the box Nginx is pretty well optimized, however there are a few basic adjustments to make. But, before opening the configuration file, you need to determine your server’s number of CPU cores and the open file limit.

Enter the following commands and make note of the return values:

grep processor /proc/cpuinfo | wc -l
ulimit -n

Next, open the Nginx configuration file, which can be found at /etc/nginx/nginx.conf:

sudo nano /etc/nginx/nginx.conf


I’m not going to list every configuration directive but I am going to briefly mention those that you should change.

Start by setting the user to the username that you’re currently logged in with. This will make managing file permissions much easier in the future, but this is only acceptable security-wise when running a single user access server.

The worker_processes directive determines how many workers to spawn per server. The general rule of thumb is to set this to the amount of CPU cores your server has available. In my case, this is 1.

The events block contains 2 directives, the first worker_connections should be set to your server’s open file limit. This tells Nginx how many simultaneous connections can be opened by each worker_process. Therefore, if you have 2 CPU cores and an open file limit of 1024, your server can handle 2048 connections per second. However, the number of connections doesn’t directly equate to the number of users that can be handled by the server, as the majority of web browsers open at least 2 connections per request. The multi_accept directive should be uncommented and set to on, which informs each worker_process to accept all new connections at a time, opposed to accepting one new connection at a time.

Moving down the file you will see the http block. The first directive to change is the keepalive_timeout, which by default is set to 65. The keepalive_timeout determines how many seconds a connection to the client should be kept open before it’s closed by Nginx. This directive should be lowered as you don’t want idle connections sitting there for up to 65 seconds if they can be utilised by new clients. I have set mine to 15.

For security reasons you should uncomment the server_tokens directive and ensure it is set to off. This will disable emitting the Nginx version number in error messages and response headers.

Underneath server_tokens add the client_max_body_size directive and set this to the maximum upload size you require in the WordPress Media Library. I chose a value of 64m.

Further down the http block you will see a section dedicated to Gzip compression. By default, Gzip is enabled but is disabled for Microsoft Internet Explorer 6, however you should tweak these values further for better handling of static files. First, you should uncomment the gzip_proxied directive and set it to any, which will ensure all proxied request responses are gzipped. Secondly, you should uncomment the gzip_comp_level and set it to a value of 2. This controls the compression level of a response and can have a value in the range of 1 – 9. Be careful not to set this value too high as it can have a negative impact on CPU usage. Finally, you should uncomment the gzip_types directive, leaving the default values in place. This will ensure that JavaScript, CSS and other file types are gzipped in addition to the HTML file type.

In order for Nginx to correctly serve PHP you also need to ensure the fastcgi_param SCRIPT_FILENAME directive is set, otherwise you will receive a blank white screen when accessing any PHP scripts. Open the fastcgi_params file:

sudo nano /etc/nginx/fastcgi_params

Ensure the following directive exists, if not add it to the file:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

That’s the basic Nginx configuration dealt with, hit CTRL X followed by Y to save the changes. For the changes to take effect you must restart Nginx, however before doing so you should ensure that the configuration file contains no errors by issuing the following command:

sudo nginx -t

If everything looks ok, go ahead and restart Nginx:

sudo service nginx restart

Restart nginx

If everything worked out ok, you should still be able to see the Nginx welcome page when visiting the FQDN in the browser.


Just like Nginx, the apt-get repository does contain PHP packages, however, they are not the most up-to-date, so I like to use one maintained by Ondřej Surý. Add the repository and update the package lists like you did for Nginx:

sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update

Then install PHP:

sudo apt-get install php7.1-fpm php7.1-common php7.1-mysqlnd php7.1-xmlrpc php7.1-curl php7.1-gd php7.1-imagick php7.1-cli php-pear php7.1-dev php7.1-imap php7.1-mcrypt -y

After the installation has completed, confirm that PHP has installed correctly:

php-fpm7.1 -v

Now that PHP has installed you need to configure the user and group that the service will run under. Because the server isn’t designed for a shared hosting environment, it’s ok to run a single PHP pool under your user account. Open the default pool configuration file:

sudo nano /etc/php/7.1/fpm/pool.d/www.conf

Change the following lines, replacing www-data with your username:

user = www-data
group = www-data
listen.owner = www-data = www-data

Next, you should adjust your php.ini file to increase the WordPress maximum upload size. Both this and the client_max_body_size directive within Nginx must be changed in order for the new maximum upload limit to take effect. Open your php.ini file:

sudo nano /etc/php/7.1/fpm/php.ini

Change the following lines to match the value you assigned to the client_max_body_size directive when configuring Nginx:

upload_max_filesize = 2M
post_max_size = 8M

Hit CTRL X and Y to save the configuration. Before restarting PHP, check that the configuration file syntax is correct:

sudo php-fpm7.1 -t

If the configuration test was successful, restart PHP using the following command:

sudo service php7.1-fpm restart

Now that Nginx and PHP have been installed, you can confirm that they are both running under the correct user by issuing the top command:


If you hit SHIFT M the output will be arranged by memory usage which should bring the nginx and php-fpm7.1 processes into view. You should notice a few occurrences of both nginx and php-fpm. Both processes will have one instance running under the root user (this is main process that spawns each worker) and the remainder should be running under the username you specified.

If not, go back and check the configuration, and ensure that you have restarted both the Nginx and PHP-FPM services.


The final package to install is MariaDB, which is a drop in replacement for MySQL. I choose MariaDB because it offers more features and speed improvements over MySQL. It’s also fully open source and has been adopted by a number of large companies. Again, the apt-get repository does contain a MariaDB package, but it’s not the most recent stable release.

Add the repository and update the package lists like you did for Nginx and PHP-FPM:

sudo apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] xenial main' -y
sudo apt-get update

To install MariaDb, issue the following command:

sudo apt-get install mariadb-server -y

You’ll be prompted to enter a root password, which should be complex, as described at the end of the previous post.

Once MariaDB has installed, you need to setup the default system tables:

sudo mysql_install_db

The last step is to secure MariaDB. Luckily, there’s a built in script which will prompt you to change a few insecure defaults:

sudo mysql_secure_installation

You will be prompted to enter the root password you created in the previous step and will be given the option to change this password if you are not happy with it.

MySQL change root password

A number of additional prompts will appear, you should accept the default values by hitting ENTER.

MySQL security prompts

Catch All Server Block

The last thing to address in this post is to remove the default server block from Nginx. Currently, when you visit the server’s FQDN in a web browser you should see the Nginx welcome page. However, unless visiting a known host the server should return a 444 response.

Begin by removing the following two files:

sudo rm /etc/nginx/sites-available/default
sudo rm /etc/nginx/sites-enabled/default

Now you need to add a catch all block to the Nginx configuration. Using nano, open the nginx.conf file:

sudo nano /etc/nginx/nginx.conf

Towards the bottom of the file you’ll find a line that reads:

include /etc/nginx/sites-enabled/*;

Underneath add the following:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _;
    return 444;

Hit CTRL X followed by Y to save the changes and then test the Nginx configuration:

sudo nginx -t

If everything looks good, restart Nginx:

sudo service nginx restart

Now when you visit the FQDN you should receive an error.

Browser error

Here’s my final nginx.conf file, after applying all of the above changes. I have removed the mail block, as this isn’t something I use. In part 8 we will customize the Nginx configuration further to improve both performance and security, but this should serve as a good starting point:

That’s all for this post, if you have any questions please feel free to ask them below. In the next post I will guide you through the process of setting up your first WordPress site and how to manage multiple WordPress installs.

About the Author

Ashley Rich

Ashley is a PHP and JavaScript developer with a fondness for solving complex problems with simple, elegant solutions. He also has a love affair with WordPress and learning new technologies.

  • @perusio has a great nginx boilerplate specifically designed for WordPress that I’ve used with great success.

    I’d recommend forking the project and customizing it to your needs. I’ve also incorporated some of @A5hleyRich’s items! Thanks Ashley!

  • Mint Plugins

    Great post thanks Ashley! Very useful.

    On a security sidenote, if you are just setting up a new server, I recommend setting up a UFW firewall:

    And then blocking SSH access from All IPs except the ones you trust:

    This way people can’t try and brute force their way into your server using SSH – unless they are literally beside you 🙂

    • Thanks for the comment. Part 1 deals with setting up UFW and Fail2Ban to mitigate the chances of someone gaining unauthorised access.

      Restricting SSH to allow only known IP addresses is certainly a solid way to secure your server, but it’s problematic when you don’t have a static IP address, like myself. As this series isn’t aimed at enterprise level security, the precautions we have detailed so far should suffice.

      • Mint Plugins

        Ah great stuff. I obviously missed part one. reading it now 🙂

      • I hope there will be a part three that covers maintenance/upgrades, and performance + security monitoring over time. Maybe also a plug for serverpilot! 🙂

        • Stay tuned. It’s going to be a pretty long series.

  • Been following these tutorials to a T, and they’ve seriously simplified my server setup. Question to all: I’m looking at H5BP’s nginx configs. Any experience with these? Any WordPress gotchas? etc. The @perusio commented on here is 3 yrs old.

    • I can’t say I’ve used either of those configs, but looking through, both have useful snippets. This series only outlines a very basic Nginx config, as it’s way beyond the scope to detail every directive. I’m going to create a new repo with an Nginx config geared towards how we’ve got things setup in this tutorial with annotated source for people to look through.

  • @A5hleyRich:disqus As you are using rtcamp nginx repository for latest nginx build which support pagespeed then why not automate whole setup with rtcamp project called EasyEngine?


    • EasyEngine seems like a good project but heres’ why I don’t use it:

      1. I like to control what software is installed
      2. If things do go wrong, it’s harder to fix when you don’t know the existing structure or configuration. Building the system yourself helps you to understand the various components of a working web server which should make tracking down problems that much easier.

      That said, there’s nothing wrong with using EasyEngine, if you just want a quick solution.

  • what changes i need to do or not to apply to make it work with user www-data?
    thanks for this amazing series

    • I believe the default user for Nginx and PHP5-FPM is the www-data user. Therefore just skip renaming them. Remember, if you are not uploading files as the www-data user you will often have to chown them, otherwise you’ll likely get forbidden errors.

      • you’re right, so i would have to chown the files from time to time, or everytime i create a new site… have you tried this installation with something like jenkins? thanks

        • That’s correct. The only time you should need to chown is when uploading anything via SFTP, unless you connect with the www-data user. I haven’t used Jenkins personally, but I don’t see any reason why it wouldn’t work.

  • O

    You suggest, and say that you have it that way, in the beginning of the post to reduce the keepalive_timeout setting in the nginx.conf from 65 to 15. However on the last section on GitHub at the value is still 65. Simple mistake or does this mean that you changed your mind for some reason and now have it at 65 again?

    • Thanks for the heads up, the final nginx.conf has been updated.

  • Just look at the last part of your nginx.conf file output:

    server {

    listen 80 default_server;

    server_name _;

    return 444;


    Do we need to input the server name value or just let it be?

    Great series, really helpful. Thanks a lot.

    • You don’t need to change anything in that server block. It’s a catch-all server block, which ensures Nginx returns the correct response for unknown virtual hosts.

      • Somehow it always gave an error at my end but when I entered the server name, I could sail through the nginx -t configuration test successfully. Probably I messed up with some settings somewhere.

  • Hello;

    any idea or post on how to install phpmyadmin or a way to manage database via workbench or toad?

  • Neither host ‘’ nor ‘localhost’ could be looked up with


    Please configure the ‘hostname’ command to return a correct


    If you want to solve this at a later stage, restart this script

    • When are you receiving this error? Did you configure your hosts as per the previous article?

      • host name is configured…. still having this problem

  • what if i use mysql5.6 or mariadb?

  • Filip Kuzmanovski

    I followed all directions, however after installing the WP Core, when I go to the domain I get a 400 Bad Request. I’ve tried looking for solutions on stack overflow and digital ocean, but I am not having any luck. Do you have any idea what might be causing this?

  • monoloops

    hello Ashley,

    Great tutorial series about nginx you helped me a lot with this. I am struggling with one thing now which is my fault! I started building my nginx server following tutorial on digital ocean but just later on, find your tutorial which was more in I continues with you..Now am back on beginning of your series looking what I’ve miss. Slap in my face, right in the beginning you installed Nginx from different source with compiled fastcgi_cache_purge. And this is exactly what is not working with my setup, so I’ve just commented out that line..

    Now, my noob question is:
    What to do now? 🙂
    How to add this module to my current server?
    Can I just update my nginx from your source?
    If I need to reinstall my nginx should backup of my nginx.conf and my sites-available conf will be enough to continue where i left off after reinstalling?

    Thanks Ashley!

    • monoloops

      Ok solved. everything works flawlessly

      • Henry Davila

        Hello how u solve that issue? because te only nginx i found it was the full version by ubuntu repositories, and nginx-costum was not able to found anywhere. soo i was to skip fastcgi_cache_purge…

  • But one important thing was missed. You need to add the following line:

    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;

    to the “/etc/nginx/fastcgi_params” config file.

    If not you will just get blank pages when accessing any php file.

    • German

      I can’t stress how important this comment was for me. I spent countless hours, searching for and looking at error logs, restarting server config from scratch several times, trying to figure out why I had a blank page in WordPress. I even had a blank page in a simple phpinfo() site. This small comment got me out of that problem.

  • Jeffrey

    Thank you very much for very detailed articles! Any follow up post for upgrading to php7? Thanks!

  • Ron Tal

    When installing all the php packages I got a “php-common deprecated” notice asking me to go through a few more steps.
    It also warned about most of these packages that they are not authenticated.
    Anything to worry about?

  • Carlos Augusto dos Santos

    This setting is very good, as I can configure nginx to support HTTP/2 ?

  • Jull Weber

    This php install you are giving is deprecated 🙁
    You should provide a working one.

    • This article was written over 1 year ago. Instead, you should install PHP 7 for all new servers.

      • Alex Poucher

        Please Help me Ashley. I have followed this tutorial step by step 100% and everything was working great. Then I got to the point of installing PHP. After I ran the following command:

        sudo apt-get install php5-fpm php5-common php5-mysqlnd php5-xmlrpc php5-curl php5-gd php5-imagick php5-cli php-pear php5-dev php5-imap php5-mcrypt

        The process started and I got a notification on screen that it was deprecated. Then it gave me commands I should run afterwards. The commands are:

        sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
        sudo apt-get update
        sudo apt-get install php7.0
        sudo apt-get install php-xdebug php-apcu

        I then hit Escape and the original command (sudo apt-get install php5-fpm php5-common php5-mysqlnd php5-xmlrpc php5-curl php5-gd php5-imagick php5-cli php-pear php5-dev php5-imap php5-mcrypt) continued until the end.

        When It was finished I then ran the following command

        php5-fpm -v

        It told me the current PHP version was PHP 5

        I then ran the other commands it told me to do so afterwards to upgrade to PHP7

        sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
        sudo apt-get update
        sudo apt-get install php7.0
        sudo apt-get install php-xdebug php-apcu

        After I did that I started getting Apache errors on the screen and now when I visit my FQDN instead of seeing NGINX has been installed I now see Apache, check it here ->

        How do I revert what just happened, get rid of apache and php7 and get back to the NGINX screen on the FQDN instead of Apache? My entire install is now at a stand still until you reply. I am willing to pay for your support and expertise. I now fear I have a bunch of things installed I do not need I fear and I have no idea how to remove them from issuing those commands that it told me to.

        sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
        sudo apt-get update
        sudo apt-get install php7.0
        sudo apt-get install php-xdebug php-apcu

        How do I remove everything that these commands installed and did?

        Please help asap.

  • Ashley, love this tutorial series, this is what make it possible for me to setup my VPS with Digital Ocean 🙂 Quick question on this one, could you expand on why using fastcgi_cache_purge ?? thanks!

  • @A5hleyRich:disqus love this tutorial series, this is what make it possible for me to setup my VPS with Digital Ocean 🙂

    Quick question on this one, could you expand on why using fastcgi_cache_purge ?? thanks!

    • `fastcgi_cache_purge` is a module which allows conditional purging of the fastcgi cache. For example, out of the box if you publish a new post you need to delete the entire cache, where as the module allows you to clear only those pages impacted.

      Since writing this series I no longer use the module, because the module is not actively maintained. Instead, I just use the Nginx mainline ( build with this plugin:

      • Scott Stawarz

        Hi Ashley,

        I’m working on a new ansible set-up, and I’m researching, and I saw your recent comment. I’m wondering since you no longer use the fastcgi_cache_purge, do you still use the same nginx conf as listed in your github repo? you then use the and you just don’t uncomment out the fastcgi_cache_purge module ? or do you have a different base-one you use?

        • Scott Stawarz

          Also want to add that your articles have been very helpful. It’s interesting to see how one sets things up differently.

          • Cheers Scott. Yeah, I still use those configs. The `fastcgi_cache_purge` section was just left in for completeness, but I no longer uncomment it.

          • Scott Stawarz

            Great thanks. That’s what I thought.

  • Joe

    I had to find the php 7 commands to replace php 5

    $ sudo php-fpm7.0 -t
    $ sudo systemctl restart php7.0-fpm

  • dimitri visser

    Installing nginx doesn’t work anymore…

    Reading package lists… Done
    W: The repository ‘ xenial Release’ does not have a Release file.
    N: Data from such a repository can’t be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: Failed to fetch 404 Not Found
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    root@vps4-chicago:~# sudo apt-get install nginx-custom -y
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package nginx-custom

    • Same Problem :/

      • dimitri visser

        Did you find a solution ? The only thing I could find was a long and boring story about compiling one myself…

        • Ruben Dominguez

          Same as well….i have not found anything and i’ve spent 20+ hours researching.

          • This post is over 18 months old now, so it’s likely some of the steps don’t work as described. Have you tried installing Nginx using the steps outlined under ‘Ubuntu PPA’:


          • Ruben Dominguez

            Hey thanks Ashely! didnt expect a reply. I was trying to go off the custom -y install, I found a separate subforum but it only complicated matters even more. Your guide has been awesome, its given me a pretty good path to start from and i feel a lot better about it than before, hopefully i can wrap up the server by the end of the week. Thanks again!

  • Jose monagas

    I am getting lots of 502 errors for admin users that want to edit the page
    socket() failed (24: Too many open files) while connecting to upstream
    Do you have any idea why is this happening?

  • As of this comment, there isn’t a release in the rtcamp/nginx repository for Ubuntu 16.04 (Xenial). Thus, fastcgi_cache_purge will not work.

  • Nick Campbell

    Ashley, 1 detail you have in here I love the idea of, but I’m worried that in production it could have a security risk. You suggest to change the user of php-fpm to your own user account. I get that if you are on your own private server that nobody else has access to, you don’t pose a risk of another system user, but the thing I’m concerned about is that my user account is a sudo user. So potentially, if the website were to be hacked and its running as my user, could the hacker use the sudo permissions to cause major damage? Am I being overly cautious, or could that pose a security risk?

  • David

    Thanks so much for this tutorial series. I see that you have recently updated it for 2017.

    Going through this for the first time, I found that after installing MariaDB and trying to setup the default system tables using the “sudo mysql_install_db” command, it errors out.

    To get around this, I had to “service mysql stop”, then run “sudo mysql_install_db”, and then “service mysql start” before proceeding to the mysql_secure_installation step.


    • Jhonis

      thanks for that tip! got same error.

  • MariaDB 10.2 is now stable and it’s available on a DigitalOcean mirror now. Copied from:–ubuntu_xenial&version=10.2&mirror=digitalocean-lon

    sudo apt-get install software-properties-common
    sudo apt-key adv –recv-keys –keyserver hkp:// 0xF1656F24C74CD1D8
    sudo add-apt-repository ‘deb [arch=amd64,i386,ppc64el] xenial main’

    • Also, at least with MariaDB 10.2 and Ubuntu Zesty, you no longer need to run mysql_install_db, I just skipped straight to mysql_secure_installation

      Thanks again for this amazing resource 🙂

  • Also, as a small quality of life improvement I also do this:

    sudo ln -s /lib/systemd/system/php7.1-fpm.service /lib/systemd/system/php.service

    That way I can restart php much more easily:

    sudo service php restart

  • Hello,

    After sudo mysql_install_db I got this output:

    Installing MariaDB/MySQL system tables in ‘/var/lib/mysql’ …
    2017-09-15 15:32:34 139765476002048 [Note] /usr/sbin/mysqld (mysqld 10.1.26-MariaDB-1~xenial) starting as process 6984 …
    2017-09-15 15:32:35 139765476002048 [ERROR] mysqld: Can’t lock aria control file ‘/var/lib/mysql/aria_log_control’ for exclusive use, error: 11. Will retry for 30 seconds
    2017-09-15 15:33:06 139765476002048 [ERROR] mysqld: Got error ‘Could not get an exclusive lock; file is probably in use by another process’ when trying to use aria control file ‘/var/lib/mysql/aria_log_control’
    2017-09-15 15:33:06 139765476002048 [ERROR] Plugin ‘Aria’ init function returned error.
    2017-09-15 15:33:06 139765476002048 [ERROR] Plugin ‘Aria’ registration as a STORAGE ENGINE failed.
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: Using mutexes to ref count buffer pool pages
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: The InnoDB memory heap is disabled
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: Compressed tables use zlib 1.2.8
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: Using Linux native AIO
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: Using SSE crc32 instructions
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: Initializing buffer pool, size = 256.0M
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: Completed initialization of buffer pool
    2017-09-15 15:33:06 139765476002048 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
    2017-09-15 15:33:06 139765476002048 [Note] InnoDB: Retrying to lock the first data file
    2017-09-15 15:33:07 139765476002048 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
    2017-09-15 15:33:07 139765476002048 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
    2017-09-15 15:33:08 139765476002048 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
    2017-09-15 15:33:08 139765476002048 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
    2017-09-15 15:33:09 139765476002048 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
    2017-09-15 15:33:09 139765476002048 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
    2017-09-15 15:33:10 139765476002048 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
    2017-09-15 15:33:10 139765476002048 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
    2017-09-15 15:33:11 139765476002048 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
    2017-09-15 15:33:11 139765476002048 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
    2017-09-15 15:33:12 139765476002048 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
    2017-09-15 15:33:12 139765476002048 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

    *** Many many times

    2017-09-15 15:34:46 139765476002048 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
    2017-09-15 15:34:46 139765476002048 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
    2017-09-15 15:34:46 139765476002048 [Note] InnoDB: Unable to open the first data file
    2017-09-15 15:34:46 7f1daf8c8900 InnoDB: Operating system error number 11 in a file operation.
    InnoDB: Error number 11 means ‘Resource temporarily unavailable’.
    InnoDB: Some operating system error numbers are described at
    2017-09-15 15:34:46 139765476002048 [ERROR] InnoDB: Can’t open ‘./ibdata1’
    2017-09-15 15:34:46 139765476002048 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
    2017-09-15 15:34:46 139765476002048 [ERROR] Plugin ‘InnoDB’ init function returned error.
    2017-09-15 15:34:46 139765476002048 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
    2017-09-15 15:34:46 139765476002048 [ERROR] Unknown/unsupported storage engine: InnoDB
    2017-09-15 15:34:46 139765476002048 [ERROR] Aborting

    Installation of system tables failed! Examine the logs in
    /var/lib/mysql for more information.

    The problem could be conflicting information in an external
    my.cnf files. You can ignore these by doing:

    shell> /usr/scripts/scripts/mysql_install_db –defaults-file=~/.my.cnf

    You can also try to start the mysqld daemon with:

    shell> /usr/sbin/mysqld –skip-grant –general-log &

    and use the command line tool /usr/bin/mysql
    to connect to the mysql database and look at the grant tables:

    shell> /usr/bin/mysql -u root mysql
    mysql> show tables;

    Try ‘mysqld –help’ if you have problems with paths. Using
    –general-log gives you a log in /var/lib/mysql that may be helpful.

    The latest information about mysql_install_db is available at
    MariaDB is hosted on launchpad; You can find the latest source and
    email lists at

    Please check all of the above before submitting a bug report

    But MariaDB is working. Do I something wrong, or it is OK?
    Please, help!