NGINX on CentOS 7
Posted on 21-09-2015 07:15
Welcome back for another tutorial! This time I'm going to show you how to get started with NGINX on CentOS 7.
CentOS 7 has been out for quite a while now, but it's not become a standard quite yet. Since they made some big changes to the way CentOS works, migrations aren't exactly what you'd call easy. In the end, though, CentOS 7 will be used by more and more people. Including those willing to run a web server!
NGINX is a popular option these days for a web server, mostly because it's able to handle a very high number of concurrent requests. A popular set up is to use it as a proxy for Apache, which can then serve application requests. That will not be covered in this tutorial, though.
So, let's set up NGINX on CentOS 7. I'm expecting a clean install here!
First let's start by ensuring your system is up-to-date. This will not only update any packages that may have an update pending, but will also update the repository caches ensuring that any packages added meanwhile have been added:
When is asks you to continue, please type 'y' to ensure everything gets updated properly.
Now, where in former CentOS versions you often had to add a separate repository to get any kind of decent version of NGINX (or NGINX at all), with CentOS 7 it's just in the main repositories. So, installation is easy:
It again asks you if you want to continue. Several other packages have been selected as well, as NGINX requires those. Type 'y' again to start the installation.
Once the installation is finished, NGINX will have been installed but is not yet running. In order to start it, type:
You should now be able to go to you server's IP address and you should see NGINX's default page. That's how easy it was!
Two more things, though:
First of all, if you reboot, NGINX won't be started automatically. In order to achieve that, run the following command:
The command itself doesn't start NGINX, but ensures it starts automatically at boot. And it would be quite convenient if that were the case, of course.
Second, the default page may not be what you are looking for. So, if you want to replace the default files with something else, go to the following directory:
And modify/replace the files in there. Either do this as root ('sudo su root') or use sudo before every command to ensure things go well. Alternatively, you can make all the files owned by www-data, by running:
That's it for this time! Hope you liked the tutorial!
Warning about ParkingCrew.com! Case: ParkingCrew.com acquires NameDrive.com but earnings are not transferred despite assurances and promises. Inquiries about this are ignored! It's just a con compagny. Don't do business with them!
|Jump to Forum
|Subject||Discussion Forum||Last Post|
|Setup for streaming live events to browser clients using Nginx, FMLE, and FlowPlayer||Linux tutorials, Tips & Tricks||: 1||16-09-2014|
|An introduction to NGINX, PHP-FPM and MariaDB on CentOS||Linux tutorials, Tips & Tricks||: 1||30-12-2013|
|An introduction to NGINX, PHP-FPM and MariaDB on Ubuntu||Linux tutorials, Tips & Tricks||: 1||30-11-2013|