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:
- Instal Nginx Centos Di Webuzo Instal Nginx Centos Di Webuzo Background Webuzo is a leading web server platform used by individuals and businesses alike. It supports a range of operating systems, including the popular CentOS…
- How To Configure Websocket Nginx Fpm How To Configure Websocket Nginx Fpm Introduction Websocket is a modern web technology that provides bidirectional communication between a web server and a web client. The websocket protocol allows for…
- Reverse Proxy Nginx Ubuntu 18.04 Reverse Proxy Nginx Ubuntu 18.04 Introduction Reverse Proxy is a type of proxy server that forwards requests to another server. It is mainly used by web servers, such as Nginx,…
- 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…
- Make Image Nginx With Dockerfile Make Image Nginx With Dockerfile Introduction to Nginx Nginx is one of the most popular web servers on the internet today. It is used by many high-profile websites, including Facebook,…
- Nginx 1.6.2 How To Resolve Nginx 1.6.2 How To Resolve What is Nginx? Nginx (pronounced "engine x") is a web server software application. It is a highly efficient and reliable server whose primary purpose is…
- 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…
- 403 Forbidden Nginx 1.10 0 Ubuntu 403 Forbidden Nginx 1.10 0 Ubuntu Introduction to 403 Forbidden Error 403 Forbidden error is a type of HTTP status code that indicates that the server is unable to complete…
- Centos 7 Install Nginx Php 7 Centos 7 Install Nginx Php 7 Nginx Server Overview and Prerequisites Nginx is a highly popular open source web server and reverse proxy software, known for its scalability and performance…
- 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 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…
- Virtualhost Nginx Ubuntu 16.04 Virtualhost Nginx Ubuntu 16.04 Introduction to Virtualhost Virtualhost is a software configuration option in web servers including Apache, Nginx, and more that allows a web server to host multiple web…
- Using Helm To Install Nginx Ingress Using Helm To Install Nginx Ingress What is Helm? Helm is an open-source Kubernetes package manager. It is used to install and manage applications on Kubernetes clusters. Helm works with…
- How To Debian Nginx Php How To Debian Nginx Php Step 1 – Setup Your VPS The first step to setting up your web server is getting your VPS (Virtual Private Server). This is usually…
- Nginx Php-Fpm Php Stack Overflow Articel Nginx Php-Fpm Php Stack Overflow Articel What Is Nginx? Nginx (pronounced engine-x) is an open source web server and reverse proxy software that is popular for its high performance and…
- How To Install Nginx Maridb 10 On Ubuntu 16.04 Lts 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.…
- Stop Nginx And Start Apache Stop Nginx and Start Apache Introduction If you’re a web developer, you know the importance of having a secure web server, and it comes down to the web server software…
- Install Laravel Nginx 16.04 Install Laravel Nginx 16.04 What is Laravel? Laravel is an open source PHP framework designed to organize, develop, and easily deploy modern web applications. It is built on the Model-View-Controller…
- Config Ssl On Nginx Centos 7 Config SSL On Nginx Centos 7 Overview Secure Sockets Layer (SSL) is a type of cryptographic protocol used for secure communications on the Internet, as well as for secure access…
- Error Nginx When Installing Certbot Ubuntu Error Nginx When Installing Certbot Ubuntu What is Nginx? Nginx is a web server software often used to serve web pages. It is known as a high-performance web server and…
- 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 Php5.6 Mysql Centos 7 Install Nginx Php5.6 Mysql Centos 7 Requirements Before we get started, let us go through the system requirements to install Nginx, Php5.6 and MySQL on CentOS 7. CentOS 7 Root…
- Install Wordpress On Ubuntu 18.04 Nginx Install WordPress On Ubuntu 18.04 Nginx Introduction To Ubuntu And Nginx Ubuntu is a popular open-source operating system which has gained immense popularity over the years. It is easy to…
- Nginx Reserve Proxy Ubuntu Docker Gunakanlah Format Penulisan Yang Efektif. Nginx Reverse Proxy Ubuntu Docker Apa Itu Nginx Reverse Proxy? Nginx reserve proxy merupakan sebuah software yang dirancang untuk membantu memproses HTTP requests. Nginx reverse…
- Ubuntu 16 Bind9 Nginx Subdomain Ubuntu 16 Bind9 Nginx Subdomain Overview Ubuntu is a popular Linux-based operating system, often used in web hosting. Bind 9 is a DNS server, commonly used in Ubuntu, that helps…
- Wordpress Nginx Ubuntu 18.04 Wordpress Nginx Ubuntu 18.04 Overview WordPress is a popular web software used by millions of people around the world. It allows users to easily create and manage websites without the…
- Vmware Files Freebsd Nginx Mysql Vmware Files Freebsd Nginx Mysql Introduction VMWare is a powerful virtualization platform that can help businesses reduce capital outlay for IT resources. One of the main benefits of using VMWare…
- Setup Nginx Web Application Firewall Setup Nginx Web Application Firewall What is Nginx WAF? Nginx Web Application Firewall (WAF) is a configuration-based firewall system used by web applications and websites. It is designed to protect…
- How To Ubuntu 16.04 Multiple Php Nginx How to Ubuntu 16.04 Multiple PHP Nginx Ubuntu 16.04 is a robust operating system that is commonly used for web application development. This operating system uses Nginx as the web…
- Ubuntu Install Web Server Nginx Ubuntu Install Web Server Nginx Step 1: Install the Nginx Package The first step when installing Nginx on Ubuntu is to install the Nginx package from the Ubuntu repository. This…