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:
- Check Nginx Status Ubuntu 16.04 Check Nginx Status Ubuntu 16.04 What is Nginx? Nginx (pronounced "engine x") is an open source web server that is used for hosting websites and applications on a wide range…
- How To Setup Nginx On Ubuntu How To Setup Nginx On Ubuntu Introduction Nginx is a powerful web server that is very popular among Linux users. It is open-source and comes with great features such as…
- Upload Max Size Nginx Phpmyadmin Upload Max Size Nginx Phpmyadmin What is Nginx? Nginx is an open source web server and reverse proxy created for high performance and scalability. It is used to serve web…
- 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…
- Certbot Ubuntu 18.04 Nginx Certbot Ubuntu 18.04 Nginx Introduction to Certbot in Ubuntu 18.04 Certbot, formerly known as Let’s Encrypt, is an open-source certificate authority (CA) managed by the Internet Security Research Group (ISRG).…
- Ubuntu 16.04 Nginx Ipv6 Ubuntu 16.04 Nginx Ipv6 What is Ubuntu 16.04? Ubuntu 16.04 is a version of the Ubuntu Linux operating system for computers and servers. Ubuntu has been around since 2004, and…
- 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 Phpmyadmin Ubuntu 18.04 Install Nginx Php Mysql Phpmyadmin Ubuntu 18.04 Introduction In this article, we will demonstrate how to install Nginx, PHP, MySQL, and phpMyAdmin on an Ubuntu 18.04 server. Nginx is a…
- Nginx Ssl Ubuntu 16.04 Nginx SSL Ubuntu 16.04 What is SSL and Nginx? SSL stands for Secure Sockets Layer. It is a protocol used to encrypt communications over the internet. It is a secure…
- Tutorial Start Nginx Ubuntu Webserver Tutorial Start Nginx Ubuntu Webserver Step 1: Prerequisites Before we start configuring Nginx as a web server on Ubuntu, we need to make sure we have the following prerequisites: A…
- Instal Nginx Ubuntu 18.04 Installing Nginx on Ubuntu 18.04 What is Nginx? Nginx is a lightweight, open source, high-performance web server designed for serving dynamic and static web content. It is capable of handling…
- Install Phpmyadmin On Nginx Ubuntu 18.04 Install Phpmyadmin On Nginx Ubuntu 18.04 Introduction PhpMyAdmin is one of the most popular and widely used web-based database management tools available. It is used for administering, managing and maintaining…
- 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…
- Remove Apache2 Ubuntu And Change To Nginx Remove Apache2 Ubuntu And Change To Nginx What Is Apache2? Apache2 is an open-source web server software created and maintained by the Apache Software Foundation. It is one of the…
- 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…
- Hhvm Nginx Ubuntu 16.4 HHVM Nginx Ubuntu 16.4 What is HHVM? HHVM, also known as HipHop Virtual Machine, is a virtual machine developed by Facebook to speed up the execution of PHP code. It…
- Install Php Nginx Ubuntu 12.04 Install Php Nginx Ubuntu 12.04 Introduction Welcome to our guide on How to install PHP, Nginx & MySQL on Ubuntu 12.04 LTS. This guide should work on other Linux VPS…
- How To Install Nginx On Ubuntu 18.04 How To Install Nginx on Ubuntu 18.04 Introduction Nginx is a popular open-source web server and reverse proxy software that’s used by millions of websites. It’s the most widely used…
- How To Remove Nginx Ubuntu 18.04 How To Remove Nginx Ubuntu 18.04 Step 1: Stop and Disable Nginx The first step is to stop and disable Nginx. This can be done by running the following commands,…
- Install Php5 Nginx Ubuntu 18.04 Install PHP5 Nginx Ubuntu 18.04 Understanding The Basics of Nginx and PHP Before we learn how to install Nginx and PHP on Ubuntu 18.04, it’s important to understand the basic…
- Cara Install Nginx Ubuntu 14.04 Cara Install Nginx Ubuntu 14.04 Step 1: Update the Software Packages The first step in installing Nginx is to update the software packages in Ubuntu 14.04. This can be done…
- 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,…
- 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…
- Failed To Start Nginx Service In Ubuntu Failed to Start Nginx Service in Ubuntu What is Nginx? Nginx is an open-source web server written in C, designed for high performance and stability. Nginx is one of the…
- Install Php Nginx Mysql Ubuntu 18.04 Install Php Nginx Mysql Ubuntu 18.04 What is PHP, Nginx, and MySQL PHP is a popular and powerful scripting language that can be used to create dynamic web pages, web…
- Install Phpmyadmin Nginx Ubuntu 16.04 Install Phpmyadmin Nginx Ubuntu 16.04 What is PhpMyAdmin? PhpMyAdmin is an open-source software for managing MySQL databases. It can be used to add, modify, and delete databases, tables, and columns.…
- 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.…
- 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…
- 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…
- Ubuntu 16 Install Nginx Php Ubuntu 16 Install Nginx Php Step 1 - Installing Nginx and PHP The first step of the process is to install Nginx and PHP. To do this, open the terminal…