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 powerful web server that can serve static or dynamic content. PHP is one of the most popular scripting languages for web development and is installed on most servers. MySQL is a powerful database server that will store all of your data. phpMyAdmin is a web-based interface that you can use to manage your MySQL databases.
Before proceeding with the installation of these packages, you should update all of your currently installed packages. You can do this by running the following command:
sudo apt update && sudo apt upgrade -y
Step 1 — Installing Nginx
The first step is to install the Nginx web server. To do this, run the following command:
sudo apt install nginx
Once the installation is complete, you can check the status of the Nginx service with the following command:
sudo systemctl status nginx
You should see the following 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 Thu 2020-03-26 09:32:51 UTC; 2min 24s ago
Main PID: 12586 (nginx)
Tasks: 2 (limit: 1152)
CGroup: /system.slice/nginx.service
├─12586 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─12593 nginx: worker process
The output shows that the Nginx service is running. To make sure that Nginx starts automatically when the system boots up, run the following command:
sudo systemctl enable nginx
You can also check the version of the Nginx web server by running the following command:
nginx -v
Step 2 — Installing PHP
The next step is to install PHP. To do this, run the following command:
sudo apt install php7.2-fpm php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-mysql php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl
Once the installation is complete, you can check the version of PHP by running the following command:
php -v
You should see the following output:
PHP 7.2.24-0ubuntu0.18.04.2 (cli) (built: Jul 21 2019 21:52:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
Step 3 — Installing MySQL
The next step is to install MySQL. To do this, run the following command:
sudo apt install mysql-server
Once the installation is complete, you can check the status of the MySQL service with the following command:
sudo systemctl status mysql
You should see the following output:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-03-26 09:56:52 UTC; 48min ago
Main PID: 15896 (mysqld)
Tasks: 27 (limit: 1152)
CGroup: /system.slice/mysql.service
├─15896 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
└─15939 sleep 1
If you want to make sure that MySQL starts automatically when the system boots up, you can run the following command:
sudo systemctl enable mysql
Step 4 — Configuring MySQL
Once the installation is complete, you need to secure your MySQL installation by running the mysql_secure_installation script. To do this, run the following command:
sudo mysql_secure_installation
You will be asked a few questions during this process. It is recommended that you answer “yes” to all of them.
Step 5 — Installing phpMyAdmin
The next step is to install phpMyAdmin. To do this, run the following command:
sudo apt install phpmyadmin
Once the installation is complete, you need to create a symbolic link for phpMyAdmin from the web root directory. To do this, run the following command:
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
Once the symbolic link is created, you need to create an Apache configuration file for phpMyAdmin. To do this, create the configuration file with the following command:
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Add the following lines:
Alias /phpmyadmin /usr/share/phpmyadmin
DirectoryIndex index.php
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
Restart the Apache service to apply the changes:
sudo systemctl restart apache2
Conclusion
In this article, we have demonstrated how to install Nginx, PHP, MySQL, and phpMyAdmin on an Ubuntu 18.04 server. We have also shown how to configure each of these packages to work properly. We hope you have found this article to be helpful.
FAQs
Q. How do I start and stop Nginx?
A. To start Nginx, you can run the following command:
sudo systemctl start nginx
To stop Nginx, you can run the following command:
sudo systemctl stop nginx
Q. How do I restart MySQL?
A. To restart MySQL, you can run the following command:
sudo systemctl restart mysql
Q. How do I access phpMyAdmin?
A. To access phpMyAdmin, you can open your web browser and go to http://your-server-ip/phpmyadmin. You will be prompted to enter your MySQL username and password.
Related Posts:
- Nginx Mariadb Php Fpm Debian8 Mariadb Nginx Mariadb Php Fpm Debian8 Mariadb Introduction to the Setup Nginx, MariaDB, and PHP are all popular tools for web development. Nginx is a web server, MariaDB is an open-source…
- 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…
- 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.…
- 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…
- Cacti Nginx Php-Fpm Alpine Cacti Nginx Php-Fpm Alpine What is Cacti? Cacti is an open-source network monitoring and infrastructure management solution that offers an easy-to-use graphical interface for graphing, logging, and analyzing network traffic.…
- 404 Nginx Phpmyadmin Centos 7 404 Nginx Phpmyadmin Centos 7 Configuration of Nginx on Centos 7 for Phpmyadmin Setting up Nginx on Centos 7 to work with Phpmyadmin is a very simple process. The first…
- Nginx Php-Fpm Php Mariadb Mysql Centos 7.2 Digitalocean Nginx, Php-Fpm, Php, Mariadb, Mysql, Centos 7.2 Digitalocean Introduction: What is Nginx? Nginx is a powerful web server that was first released in 2004. It is known for being a…
- How To Install Cachet Nginx How To Install Cachet Nginx Overview Cachet is an open-source monitoring platform that is widely used by web developers, DevOps engineers, and system administrators for monitoring the performance of a…
- How To Install Nginx And Mariadb 10 How To Install Nginx And Mariadb 10 What is Nginx and MariaDB 10 Nginx is a free, open-source web server that is known for its scalability and performance. It is…
- 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…
- Install Nginx Php Java On Centos 7 Install Nginx Php Java On Centos 7 What is Nginx? Nginx is an open source Web server created to serve Web traffic efficiently, reliably, and quickly. Nginx has become the…
- 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…
- Bash Install Nginx On Ubuntu How To Install Nginx On Ubuntu What is Nginx? Nginx is a web server that is gaining popularity in the world of web hosting. Nginx is an open source web…
- Vps Webserver Nginx Php7 Mysql Vps Webserver Nginx Php7 Mysql What Is VPS Webserver? A VPS webserver is a Virtual Private Server (VPS) that has been configured to act as a web server. A VPS…
- Php Run On Server Apache Nginx PHP Run on Server Apache Nginx What is PHP? PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source scripting language that can be used to create dynamic…
- Error Install Nginx On Ubuntu Error Install Nginx On Ubuntu What is Nginx? Nginx is a web server software used to host web applications. It is open source software developed by the open source community.…
- 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…
- Install Nginx Php Raspberry Pi Install Nginx Php Raspberry Pi What Is a Raspberry Pi? The Raspberry Pi is a low-cost, energy-saving device, made primarily for educational purposes. It is a small, single board computer…
- 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…
- 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…
- Nginx Always Displaying Default Page In Ubuntu Nginx Always Displaying Default Page In Ubuntu Introduction Ubuntu is one of the most popular Linux distributions and an immensely powerful and versatile operating system. It has a great package…
- Php-Fpm Nginx Ubuntu 18.04 PHP-FPM & Nginx on Ubuntu 18.04 Introduction to PHP-FPM PHP-FPM (FastCGI Process Manager) is an implementation of FastCGI, which is a standard protocol for interfacing external applications with web servers.…
- Docker Nginx Php Mysql In Xampp Docker Nginx Php Mysql In Xampp Overview of Docker Nginx Php Mysql in Xampp Docker Nginx Php Mysql in Xampp is a powerful web development platform used for developing complex…
- 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…
- Cara Agar Mysql Diakses Hanya Menggunakan Ip Tertentu Nginx Cara Agar Mysql Diakses Hanya Menggunakan IP Tertentu - Nginx Apa itu Nginx? Nginx adalah salah satu server web populer di seluruh dunia. Nginx telah menjadi pilihan yang populer di…
- 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 Nginx Ubuntu Server 16.04 Install Nginx Ubuntu Server 16.04 Introduction to Nginx Nginx is a high performance web server and reverse proxy. It is normally used for serving static content such as images, static…
- 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…
- 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 Install Phpmyadmin In Ubuntu 18.04 Nginx How To Install Phpmyadmin In Ubuntu 18.04 Nginx Introduction The MySQL database management system is one of the most popular and powerful open source database systems available today. To make…