Step By Step Install Nginx And Phpmyadmin On Ubuntu
Introduction
Setting up a web server on Ubuntu is easy and straightforward. Nginx is a popular web server for Ubuntu, and it can be used for hosting websites, running web applications, and managing databases. Additionally, phpMyAdmin is a widely used web-based database management system. Nginx and phpMyAdmin are both available in Ubuntu’s repositories, which makes installation and set-up relatively easy. In this article, we’ll install Nginx and phpMyAdmin on Ubuntu 18.04.
Prerequisites
Before you begin, you will need the following:
- A server running Ubuntu 18.04.
- A user with sudo privileges.
Step 1 – Installing Nginx
Nginx is available in Ubuntu’s repositories, so we can install it using apt. To do this, connect to your server via SSH and update your package list with the command:
sudo apt update
Now, you can install Nginx with:
sudo apt install nginx
Once installed, you should see the output below:
Output
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
...
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
...
Nginx is being configured
Setting up nginx (1.14.0-0ubuntu1.2) ...
When the installation completes, you can check if the service is running with the command:
sudo systemctl status nginx
You should see something similar to the following output, which indicates that Nginx is running:
Output
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-04-10 17:10:09 UTC; 8min ago
Docs: man:nginx(8)
Main PID: 3165 (nginx)
Tasks: 2 (limit: 1153)
CGroup: /system.slice/nginx.service
├─3165 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─3166 nginx: worker process
Apr 10 17:10:08 ubuntu1804 systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 10 17:10:09 ubuntu1804 systemd[1]: Started A high performance web server and a reverse proxy server.
You can also verify that Nginx is running by accessing the IP address of your server in a web browser. You should see a welcome page, which looks like this:
Step 2 – Installing phpMyAdmin
Now we can install phpMyAdmin. First, we need to add the repository:
sudo add-apt-repository ppa:ondrej/php
When prompted, press ENTER to continue. Now, we can update our packages and install phpMyAdmin with the command:
sudo apt update
sudo apt install phpmyadmin
You will be asked a few questions during the installation. For the webserver selection, select apache2.
You’ll also be asked to configure a database for phpMyAdmin to use. Select yes, and then choose a password for the phpMyAdmin user. Make sure to remember this password. When you’ve finished, press OK.
Once it’s installed, you can access phpMyAdmin in a web browser. You’ll be asked to sign in with the user and password you just created. When you log in, you’ll see the phpMyAdmin dashboard.
Step 3 – Configuring Nginx
Now that Nginx and phpMyAdmin are both installed, we can configure Nginx to serve phpMyAdmin. First, we need to create a configuration file in the sites-available directory.
sudo nano /etc/nginx/sites-available/phpmyadmin
Add the following lines to the file:
server {
listen 80;
server_name the_domain_or_IP;
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/phpmyadmin/(.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
}
Save the file, exit the text editor, and activate the configuration with the command:
sudo ln -s /etc/nginx/sites-available/phpmyadmin /etc/nginx/sites-enabled/
You can verify the configuration syntax with:
sudo nginx -t
If it’s valid, you should see the output below:
Output
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Finally, restart Nginx for the changes to take effect:
sudo systemctl restart nginx
Now, you can access phpMyAdmin in a web browser. You will be asked to log in with the user and password you created during installation.
Conclusion
We’ve successfully installed and configured Nginx and phpMyAdmin on Ubuntu 18.04. You should now have a basic web server that you can use to serve websites and web applications. Good job!
FAQs
Q: What is Nginx?
A: Nginx is a popular high performance web server used by websites and applications.
Q: What is phpMyAdmin?
A: phpMyAdmin is a web-based database management system used for managing MySQL and MariaDB databases.
Q: What is the default port for Nginx?
A: The default port for Nginx is port 80.
Q: How can I access phpMyAdmin?
A: You can access phpMyAdmin in a web browser by navigating to http://your-server-IP/phpmyadmin.
Thank you for reading this article. For more information please visit our other articles.
Related Posts:
- Ubuntu Server Postgresql Nginx Php Digitalocean Laravel Ubuntu Server Postgresql Nginx Php Digitalocean Laravel Introduction To The Stack Ubuntu Server, Postgresql, Nginx, PHP, Digitalocean and Laravel are an exceptional combination of elements that, when put together, make…
- Nginx Wordpress Ubuntu 18.04 Nginx Wordpress Ubuntu 18.04 Introduction to Nginx Nginx is a web server software for hosting websites and applications. It is open-source and highly configurable, making it a popular choice for…
- Install Phpmyadmin On Nginx Ubuntu Install Phpmyadmin On Nginx Ubuntu What Is Phpmyadmin? Phpmyadmin is a free, open source web application written in PHP specifically designed to help manage MySQL databases. It is a powerful…
- Can I Install Phpmyadmin In Nginx Can I Install Phpmyadmin In Nginx? PHPmyadmin is a web-based management tool for databases such as MySQL and MariaDB. It is a popular tool for web developers and database administrators…
- Setting Php Nginx Ubuntu Vps Setting Up a PHP, Nginx, and Ubuntu VPS What is a VPS? A Virtual Private Server (VPS) is a type of virtualized hosting. It works in the same way as…
- Install Rails On Ubuntu Nginx Rbenv Install Rails On Ubuntu Nginx Rbenv Introduction Rails is an open-source web application framework written in Ruby. It is designed to make programming web applications easier by providing a full…
- 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…
- Virtual Host Nginx Ubuntu 16.04 Virtual Host Nginx Ubuntu 16.04 Introduction A virtual host (also known as Virtual Private Server or VPS) is a service that allows a single physical server to host multiple websites.…
- Install Nginx Php Mysql Ssl & Wordpress On Ubuntu 18.04 Install Nginx Php Mysql Ssl & Wordpress On Ubuntu 18.04 What is Nginx, Php, Mysql, SSL and Wordpress? Nginx is a high-performance web server that is widely used to serve…
- Ubuntu Server Postgresql Nginx Php Ubuntu Server Postgresql Nginx Php Introduction Optimizing your server is one of the most important steps you can take when it comes to running a successful website or application. It…
- Install Laravel Ubuntu 16.04 With Nginx Web Server Install Laravel Ubuntu 16.04 With Nginx Web Server Introduction Laravel is one of the most popular expressive, elegant, and robust PHP frameworks available today. It is an open source framework…
- Install Postgis Ubuntu 18.04 Nginx Install Postgis Ubuntu 18.04 Nginx What is Postgis? Postgis is a Postgres-based open source geographic information system (GIS) that enables users to store, query, and analyze spatial data stored in…
- Install Nginx Php Oracle Ubuntu Install Nginx, Php, Oracle, Ubuntu Installing Nginx on Ubuntu Nginx is a popular web server software based on the LEMP stack that is widely used to host web applications, especially…
- Install Phpmyadmin For Nginx Debian 8 Install Phpmyadmin For Nginx Debian 8 Introduction The Nginx web server popularly known as Nginx is a lightweight web server written in C programming language. It is an open source…
- Install Nginx Ubuntu 16.04 For Odoo Install Nginx Ubuntu 16.04 For Odoo Install Ubuntu Server 16.04 Before we can install Nginx for Odoo we need to install Ubuntu 16.04 on our server. Ubunutu 16.04 is still…
- 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…
- Install Pdo_Mysql Ubuntu Nginx Install Pdo_Mysql Ubuntu Nginx What is Pdo_Mysql? PDO_Mysql is a driver for the PHP Data Objects (PDO) extension that provides a database abstraction layer for working with MySQL databases.PDO_Mysql provides…
- Install Nginx Latest Ubuntu 16.04 Install Nginx Latest Ubuntu 16.04 What is Nginx? Nginx is a web server. It is also an open source and free software. It was first developed by Igor Sysoev in…
- How To Set Rails On Nginx Ubuntu 18.04 How To Set Rails On Nginx Ubuntu 18.04 Step 1: Install Ruby Using RVM The first step for setting up Ruby on Rails on an Ubuntu 18.04 server with Nginx…
- Nginx Install Custom Directory Phpmyadmin Nginx Install Custom Directory PhpMyAdmin Introduction to Nginx and PhpMyAdmin Nginx is a web server and content caching solution used to host a variety of web applications. It is highly…
- Install Nginx Ubuntu 18.08 Local Install Nginx on Ubuntu 18.04 Local Installing Nginx on Ubuntu 18.04 can be accomplished quickly and in several different ways. Depending on your needs, some methods may be better suited…
- 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…
- Ubuntu Install Nginx Php7.2 Mysql Ubuntu Install Nginx Php7.2 Mysql What is Nginx? Nginx is an open source web server that is very popular for powering web applications such as WordPress and Drupal. It is…
- How To Login Phpmyadmin In Nginx Server Ubuntu How To Login Phpmyadmin In Nginx Server Ubuntu What is Nginx & phpMyAdmin Nginx is a web server software that is commonly used on Linux-based systems, though it works on…
- Install Nginx Mysql Phpmyadmin Ubuntu Install Nginx Mysql Phpmyadmin Ubuntu 1. Introduction In today's tutorial, we will show you how to install Nginx, MySQL, and phpMyAdmin on Ubuntu 20.04. Nginx is an open source web…
- Digitalocean Letsencrypt Nginx Ubuntu 18.04 Digitalocean Letsencrypt Nginx Ubuntu 18.04 Introduction Ubuntu 18.04 is the latest version of the popular Linux operating system. Digitalocean is a cloud hosting provider that specializes in hosting and managing…
- Install Wordpress On Ubuntu Vps On Nginx Install Wordpress On Ubuntu VPS On Nginx What is WordPress? WordPress is an open-source, content management system (CMS) top-tier overall that is used to create powerful online presence. It powers…
- Install Wordpress On Nginx Ubuntu Install Wordpress On Nginx Ubuntu Introduction WordPress is a popular open-source blogging platform and content management system (CMS). It is made to be used on the internet, and it is…
- Install Nginx 1.16 Ubuntu Install Nginx 1.16 Ubuntu Introduction to Nginx 1.16 Nginx 1.16 is a web server that helps you to serve web content quickly, efficiently and securely. It is especially popular with…
- Ubuntu Server18 How To Enable Nginx Pdo Mysql Ubuntu Server18: How to Enable Nginx Pdo Mysql As a developer, you may have heard of Nginx, PDO, and MySQL – all are essential components of web applications. Nginx is…