Installing Nginx, Along with PHP, MYSQL

Nginx is a high performance HTTP server. It provides very fast speed of delivering web pages, and uses fewer resources at the same time. With Nginx (Pronounced Engine X) A server with low resources will be able to serve many more clients, due to this, many popular websites use this (To conserve their resources, of course). In this blog post, I am going to discuss how to install Nginx, along with PHP, and MYSQL. You will need to follow very close attention to this article, else, one mistake and you may need to restart all over again. The first thing you will need to do of course is own a VPS/Dedicated server. You will also need to have an SSH Client (Putty), and your username and password. If you have all of this, the first thing you need to do is login to your panel, and rebuild the server with some version of CentOS (it does not matter what version, really). Once you have done so, login to your SSH client, supplying the required information. Next, we are going to begin the actual procedure. Follow these steps very closely. 1st We will need to install MYSQL. To do so, copy and paste the command below. “yum install mysql mysql-server” – Without the quotations of course. Next, we will set the server to start MYSQL whenever the system is rebooted. This will help significantly, else you will need to login to the console every time you need to reboot, and then you will need to type in a command to start MYSQL. To set the server to start MYSQL when the server boots, follow the steps below. – Type in, copy “chkconfig – levels 235 mysqld on /etc/init.d/mysqld start” – Once the above command has been entered, enter “netstat -tap | grep mysql” The screen should then look something like this (The text).
# netstat -tap | grep mysql
tcp        0      0 *:mysql       *:*      LISTEN      2388/mysqld
Once you get that screen, you will want to reboot your MYSQL server, this will append any changes that you have made. To do so, copy this command “/etc/init.d/mysqld restart”. Now, you need to actually setup MYSQL (Remember, all you just did was actually install the server). To start the install/configuration process, use this command “mysql_secure_installation”. All you will need to do is set your root password. Once you have done this, you are done with the installation of MYSQL. (Yay!). When MYSQL is installed, it also installs PHP..just so you know that I didn’t forget about that in this tutorial 😉 The next step is to install the actual server (Nginx). This is very much easier then installing MYSQL (or at least in my opinion). The HTTP engine has not yet been released for final, for centos, though there are repositorys that may be used with it. To install the repositorys, you will need to type in the command as follows. “cd /etc/yum.repos.d/” “wget” It should then open a file like:
# pkgs in the -Testing repo are not gpg signed
name=CentOS.Karan.Org-EL$releasever - Testing
You will need to set GPGCHECK to 0, and enabled to 1. Once you have done that, run this command “yum install Nginx”. Once that is done, we also need to make the server start on boot, to do this type in the following command.
chkconfig --levels 235 nginx on
/etc/init.d/nginx start
Now, reboot the server, and then type in the server IP in your browser. When you do so, you should see just a blank page..if you do everything is working correctly..the page is only blank because you haven’t added any content. If you would like to do so, you should install an FTP server. And set it to “/usr/share/nginx/html/index.html”. That’s it! Your done!

Leave a Reply

Your email address will not be published. Required fields are marked *


Your browser is out of date. It has security vulnerabilities and may not display all features on this site and other sites.

Please update your browser using one of modern browsers (Google Chrome, Opera, Firefox, IE 10).

2014 Summer Sale