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 user
- Enough disk space and memory
- SSH client
All the packages needed for installing these elements will be downloaded from the official CentOS repositories.
Installation of Nginx
First, we will install Nginx from the official CentOS repositories. To do this, we need to use either yum or dnf. The exact command for using yum for installing the Nginx package is given below:
$ yum install nginx
Once the command is successfully executed, you will see the installation process, and at the end, you will receive a notification that the installation was successful.
Nginx is now installed, but it won’t start automatically. To start it, use the following systemctl command:
$ systemctl start nginx
If you want to make sure that the service is running, you can do a check on it using the status command.
$ systemctl status nginx
Installation of Php5.6
To install Php5.6 on CentOS 7, we need to use either yum or dnf. The exact command for using yum for installing the Php5.6 package is given below:
$ yum install php56
Once the command is successfully executed, you will see the installation process, and at the end, you will receive a notification that the installation was successful.
The next step is to install additional packages that are necessary for running web applications. These packages can be installed with the following command:
$ yum install php56-pdo php56-mysqlnd php56-xml
Once the command is successfully executed, you will see the installation process, and at the end, you will receive a notification that the installation was successful.
Installation of MySQL
To install MySQL on CentOS 7, we need to first use the yum command like we did for installing Nginx and Php5.6. The exact command for using yum for installing the MySQL package is given below:
$ yum install mysql-server
Once the command is successfully executed, you will see the installation process, and at the end, you will receive a notification that the installation was successful.
Next, you need to start MySQL by using the following command:
$ systemctl start mysqld
The last step is to secure MySQL by creating a root password. To do this, use the following command:
$ mysql_secure_installation
Configuring Nginx
Now that we have installed all the necessary components, we need to configure Nginx. To do this, we will be creating a virtual host file.
First, make sure that you have the default Nginx configuration file in the following path:
/etc/nginx/conf.d/default.conf
Once you have the file in place, edit it with a text editor of your choice and then add the following code to it:
server {
listen 8080;
server_name domain.tld www.domain.tld;
root /srv/domain.tld/httpdocs;
index index.html index.htm;
location / {
include fastcgi_params;
try_files $uri /index.php?$query_string;
fastcgi_pass 127.0.0.1:9000; #this value might be different for you
}
error_page 404 /404.html;
location = /404.html {
root /srv/domain.tld/httpdocs;
}
location ~ .php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000; #this value might be different for you
}
}
This code needs to be modified with your own parameters (domain name, IP address, etc). Once you have done that, you need to save the file and restart Nginx. To do that, use the following command:
$ systemctl restart nginx
Testing the Setup
Now that we have installed and configured everything, it is time to test the setup. To do this, first create a file in the /srv/domain.tld/httpdocs directory and name it index.php. Then add the following code to it:
echo phpinfo();
?>
This code will generate information about the version of PHP you are using. Now, visit the domain in a browser and you should see the PHP information page. If you see it, then you have successfully installed Nginx, Php5.6 and MySQL on CentOS 7!
Conclusion
In this article, we have gone through the process of installing and configuring Nginx, Php5.6 and MySQL on CentOS 7. We have also seen how to create a virtual host file and how to test the setup.
Thank you for reading this article. Please read other articles for more interesting and informative topics.
Related Posts:
- Nginx Css And Image Not Showing Centos Nginx Css And Image Not Showing Centos Common Problems When Nginx CSS And Images Aren't Showing When you're working with Nginx on the Centos operating system, you may have run…
- Install Nginx And Php Scract In Docker Install Nginx And PHP Script in Docker What is Docker? Docker is a popular platform for creating, running, and managing applications in a lightweight container system. Originally released as an…
- Instal Nginx 1.5.0 Installing Nginx 1.5.0 Overview of Nginx Nginx is a web server that is used to serve web content quickly and reliably. It is popularly used in asynchronous web applications, due…
- 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…
- Remove Nginx Completely Centos 7 Remove Nginx Completely Centos 7 Overview This article will provide a brief overview of Nginx, some of the ways it can be removed from a Centos 7 system and directions…
- Selinux Enable Php Fpm Nginx Centos 7 Selinux Enable Php Fpm Nginx Centos 7 What is Selinux Enable Php Fpm Nginx Centos 7? Selinux Enable Php Fpm Nginx CENTOS 7 is an easy-to-use web server and operating…
- Certbot Centos 7 Nginx Certificate Invalid Certbot Centos 7 Nginx Certificate Invalid What is Certbot & Centos 7 Nginx Certificate? Certbot is an open-source software project from the Electronic Frontier Foundation (EFF). It enables website owners…
- Nginx Docker Swarm Config With Defferent Server Nginx Docker Swarm Config With Different Server Introduction to Nginx and Docker Nginx is a popular open-source web server that is used for serving static content, as well as for…
- 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…
- 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…
- Php-Fpm Cache Nginx Centos Php-Fpm Cache Nginx Centos Introduction to Nginx, Php-Fpm, and Centos Nginx, PHP-FPM, and Centos are three powerful, open-source technologies that are used to create powerful applications, websites, and services. Nginx…
- Wordpress Mariadb Nginx On Centos 7 Wordpress Mariadb Nginx On Centos 7 Installing Apache Apache is the most popular web server in the world. It is a powerful, versatile, and free open source software available for…
- 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…
- 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…
- 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 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…
- 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 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…
- Centos 7 Nginx Letsencrypt Https And Https Both Active Centos 7 Nginx Letsencrypt Https And Https Both Active Introduction Are you overwhelmed with the number of steps required to set up an SSL certificate in CentOS 7? If so,…
- Install Nginx Php Mysql Windows Title Here Install Nginx Php Mysql Windows Introduction For a variety of reasons, many web developers and programmers look to install a local development version of a web server, such…
- How Use Nginx Mysql Ubuntu How to Use Nginx, MySQL and Ubuntu What is Nginx? Nginx is an open source web server and reverse proxy software written by Igor Sysoev. It is a popular choice…
- How To Install Laravel On Centos 7 With Nginx How To Install Laravel On Centos 7 With Nginx What is Laravel? Laravel is an open-source framework for web development built on the model-view-controller (MVC) architectural pattern. Created in 2011…
- 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…
- Centos 7 Nginx Error Log Not Write Centos 7 Nginx Error Log Not Write What is Nginx? Nginx is an open source web server and web application framework created by Igor Sysoev for the common website hosting…
- Centos 7 Nginx Php Worker Process And Worker Connection Centos 7 Nginx PHP Worker Process And Worker Connection What is Nginx? Nginx (pronounced "engine-x") is an open source web server software designed with high performance, stability and low memory…
- 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…
- Nginx Multi Domain Centos 7 Nginx Multi Domain Centos 7 Introduction to Nginx Nginx is an open source, high performance web server software written in C language, designed to be deployed on Linux and Unix-like…
- Nginx And Apache Together Centos Nginx and Apache Together in Centos Overview A popular choice for websites is using the powerful combination of Nginx and Apache together. The two web servers are both reliable and…
- Step By Step Install Nginx And Phpmyadmin On Ubuntu 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…
- Install Phpmyadmin Nginx Ubuntu 16.04 Php 7 Install Phpmyadmin Nginx Ubuntu 16.04 Php 7 Introduction to PhpMyAdmin PhpMyAdmin is a web-based tool that enables the users to manage their MySQL databases. It also provides a graphical interface…