How To Install Nginx Maridb 10 On Ubuntu 16.04 Lts
Step 1 — Installing Nginx
The first step in installing Nginx and MariaDB 10 on Ubuntu 16.04 is installing Nginx. Nginx is a web server and a proxy server for protocols such as HTTP and SMTP. Ubuntu 16.04 comes with Nginx installed by default, but if you want to upgrade to the latest version then you can use the command below to install it.
Run the following command in your terminal to start the installation of Nginx:
sudo apt install nginx
Nginx is now installed and up and running on your system. You can verify it by checking the version with the command:
nginx -v
The output should look something like this:
nginx version: nginx/1.11.10
Step 2 — Installing MariaDB 10
The next step is to install MariaDB 10. MariaDB 10 is a popular drop-in replacement for MySQL. It is a powerful database system that is used by many high traffic websites. To install MariaDB 10 on Ubuntu 16.04, simply run the following command in your terminal:
sudo apt install mariadb-server
Once the installation is complete, you can run the MySQL secure installation command to set up the root password and secure the database:
sudo mysql_secure_installation
You will be asked a few questions such as setting the root password, removing anonymous users, etc. Answer these questions as appropriate for your environment. Once you have set everything up, you can verify that MariaDB is running by typing the following command:
mysql -u root -p
Enter the root password to access the MariaDB console. To view all available databases, type:
show databases;
This should output a list of databases such as:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
Step 3 — Installing phpMyAdmin
phpMyAdmin is a web-based graphical interface for managing MySQL and MariaDB databases. Installing phpMyAdmin on Ubuntu 16.04 is fairly simple. First, you need to install wget if it is not installed on your system by using the command below:
sudo apt install wget
Next, you need to download the latest version of phpMyAdmin from the official website:
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
Extract the downloaded file with the following command:
tar -xvzf phpMyAdmin-latest-all-languages.tar.gz
This will create a new directory containing phpMyAdmin. Now, you need to move the phpMyAdmin files to the webroot directory as follows:
sudo mv phpMyAdmin-4.7.4-all-languages /var/www/html/phpMyAdmin
You can now access phpMyAdmin from your browser by navigating to http://your-server-ip/phpMyAdmin. You should see the phpMyAdmin login page.
Step 4 — Configuring Nginx
Now we need to configure Nginx to serve the phpMyAdmin files. To do this, first create a new Nginx virtual host configuration file as follows:
sudo nano /etc/nginx/sites-available/phpmyadmin.conf
Paste the following lines into the file. Make sure you replace the server_name with your domain name or the public IP address of the server:
server {
listen 80;
server_name www.example.com;
root /var/www/html/phpmyadmin;
location / {
index index.php index.html index.htm;
}
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
Save and close the file when you are finished. Now, you need to enable the newly created virtual host file by creating a symbolic link from the sites-available directory to the sites-enabled:
sudo ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
Now, you need to restart Nginx for the changes to take effect:
sudo systemctl restart nginx
Step 5 — Securing phpMyAdmin
By default, phpMyAdmin is accessible to any user on the internet. This is a major security risk, so you should always secure your phpMyAdmin installation. The easiest way to do this is by creating an .htaccess file in the phpMyAdmin directory. To do this, run the following command:
sudo nano /var/www/html/phpmyadmin/.htaccess
Then, paste the following lines in the file:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user
Save and close the file. Now, you need to create a .htpasswd file which will store the username and password of the user who will be allowed to access phpMyAdmin. To do this, run the following command:
sudo htpasswd -c /etc/phpmyadmin/.htpasswd username
Replace “username” with the username you want to use. Next, you will be prompted to enter and re-enter a password for the user. After this, you should be able to access phpMyAdmin remotely but only after entering the correct username and password.
Conclusion
In this tutorial, we have seen how to install Nginx and MariaDB 10 on Ubuntu 16.04. We have also seen how to install and configure phpMyAdmin and how to secure it with an .htaccess file.
Thank you for reading this article. Please read other articles.
Related Posts:
- Laravel Nginx Config Ubuntu 18 Laravel Nginx Config Ubuntu 18 Introduction Laravel is a powerful web-based MVC (Model-View-Controller) framework used by developers to create web applications, websites and APIs. It is based on the popular…
- Easyengine Detected A Previously Installed Nginx Package Easyengine Detected A Previously Installed Nginx Package What is EasyEngine? EasyEngine is a command line tool that is used for installing, configuring, and managing web servers. It provides a simple…
- Nginx Install Ssl Certificate Ubuntu Nginx Install SSL Certificate Ubuntu What is Nginx? Nginx is a free, open-source web server that is used for powering websites. It is popular for its speed, scalability, and stability,…
- Install Odoo 11 Nginx Ubuntu 16 Install Odoo 11 Nginx Ubuntu 16 What is Odoo 11 Nginx? Odoo 11 Nginx is an open source software package designed to facilitate secure and reliable web development. It is…
- Install Squirellmail On Nginx Ubuntu Install Squirrelmail On Nginx Ubuntu 1. What is Squirrelmail? Squirrelmail is a webmail application written in PHP. It is often used as an email client for the Linux operating system…
- Deploy Laravel Nginx Ubuntu 17 Deploy Laravel Nginx Ubuntu 17 Requirements for Installing Laravel 5.4 on Ubuntu 17 This article will guide you through the process of installing Laravel 5.4 on Ubuntu 17. Before we…
- Install Mariadb Nginx Debian 9.7 Install Mariadb and Nginx on Debian 9.7 Overview of Installing MariaDB and Nginx on Debian 9.7 Installing MariaDB and Nginx on Debian 9.7 can be an essential step when setting…
- How To Install Phpmyadmin On Nginx How To Install Phpmyadmin On Nginx Introduction PhpMyAdmin is an open source software program which is used to manage MySQL and MariaDB databases. It provides a graphical interface to execute…
- Install Nginx Phpmyadmin Ubuntu 18.04 Install Nginx Phpmyadmin Ubuntu 18.04 Introduction to Nginx, PHP, and Ubuntu Nginx is an open-source, high-performance web server written in C and used to serve static and dynamic webpages. It…
- Install Nginx Php Mysql Windows Server Install Nginx Php Mysql Windows Server Install Nginx Php Mysql Windows Server Installing Nginx Nginx is a web server that can be used to serve dynamic web pages as well…
- Digitalocean Install Nginx Ubuntu 18.04 Digitalocean Install Nginx Ubuntu 18.04 Introducing DigitalOcean and Nginx DigitalOcean is a virtual cloud server provider, allowing users to spin up virtual servers located in various geographical locations throughout the…
- How To Set Up Nginx Loadbalancer Ubuntu How To Set Up Nginx Loadbalancer Ubuntu Introduction to Nginx Loadbalancer Nginx Loadbalancer is a web application that lets you easily set up load balancing for your website. It is…
- Tutorial Install Nginx Di Ubuntu Vps Tutorial Install Nginx Di Ubuntu Vps Step 1: Install Nginx The first step to install nginx in your Ubuntu VPS is to install the nginx package. To do this, use…
- Install Webuzo Without Conlicting Nginx Centos 7 Install Webuzo Without Conlicting Nginx Centos 7 What is Nginx? Nginx is an open-source web server that was created and released in 2004. It is known for its speed, stability,…
- Install Nginx On Mac Without Brew Install Nginx On Mac Without Brew What Is Nginx? Nginx is an open-source web server that is used for hosting websites and applications. It is highly customizable and can be…
- Cask Nginx Is Unavailable No Cask With This Name Exists Cask Nginx Is Unavailable No Cask With This Name Exists What Is Cask Nginx? Cask Nginx is an open-source web server software developed by the Nginx Foundation. It is used…
- Nginx Php Fpm 7.2 Nginx Php Fpm 7.2 Introduction to Nginx and PHP-FPM Nginx is an open-source web server, reverse proxy server, and load balancer. It is known for being lightweight and fast, and…
- Install Nginx And Php On Ubuntu Install Nginx And Php On Ubuntu A Comprehensive Tutorial to Install Nginx And Php On Ubuntu Nginx and PHP are two of the most popular web server and scripting language…
- Ubuntu Nginx Fastcgi 7.2 Ubuntu Nginx Fastcgi 7.2 What is Ubuntu Nginx Fastcgi? Ubuntu Nginx Fastcgi is an open-source web server that is used to provide web hosting services on Ubuntu Linux. It provides…
- Upgrade Nginx Ubuntu 18.04 Upgrade Nginx Ubuntu 18.04 Getting Started with Nginx Ubuntu 18.04 Installation Nginx is a high performance web server and reverse proxy. It is written in C and has ways to…
- Install Nginx Server On Centos 7 Install Nginx Server On Centos 7 What Is Nginx? Nginx is an open source web server and reverse proxy developed by Igor Sysoev in 2004. It is an efficient web…
- Ubuntu 16.04 Nginx-Extras Ubuntu 16.04 Nginx-Extras Introduction to Nginx-Extras on Ubuntu 16.04 Nginx-Extras are a set of extra features for Nginx, such as WebDAV, Secure Token (STS),gzip precompression, and GeoIP. All of these…
- Install Laravel 5.1 Ubuntu 16.04 Nginx Install Laravel 5.1 on Ubuntu 16.04 Nginx Introduction Laravel is a free, open-source PHP web application framework that is highly popular with modern web developers. It leverages an expressive and…
- Install Rapidssl Nginx Ubuntu 18.04 Install RapidSSL with Nginx on Ubuntu 18.04 Step 1: Installing Nginx The first step in setting up RapidSSL with Nginx on Ubuntu 18.04 is to install Nginx itself. This can…
- How To Install Nginx On Centos 7 Rhel 7 How To Install Nginx On Centos 7 Rhel 7 Nginx is one of the most popular web servers around the globe – being an open-source application, it drives a large…
- Install Nginx Phpmyadmin Centos 7 Install Nginx Phpmyadmin Centos 7 What is Nginx? Nginx is a web server that is used in Linux-based operating systems such as Centos 7. It is designed to handle high-traffic…
- How To Ufw Allow Nginx Http Digitalocean How To Ufw Allow Nginx Http Digitalocean What is UFW for Nginx on DigitalOcean? UFW (Uncomplicated Firewall) is a firewall application package for use with the Ubuntu Linux operating system.…
- Deploy Laravel In Local Nginx Windows Deploy Laravel In Local Nginx Windows 1. Introduction To Nginx Nginx is a web server that is primarily used to handle web traffic. It is open source, meaning it is…
- Nginx Command Not Found Ubuntu Nginx Command Not Found Ubuntu What is Nginx? Nginx (pronounced as Engine X) is an open source web server created to handle high traffic network applications, replacing traditional web servers…
- Install Nginx On Centos 6 Install Nginx on CentOS 6 What is Nginx? Nginx is a web server and a reverse proxy server for HTTP, HTTPS, SMTP, POP3 and IMAP protocols, with a strong focus…