This article covers a version of CentOS that is no longer supported. If you are currently operating a server running CentOS 6, we highly recommend upgrading or migrating to a supported version of CentOS.
Reason: CentOS 6 reached end of life (EOL) on November 30th, 2020 and no longer receives security patches or updates. For this reason, this guide is no longer maintained.
See Instead:
This guide might still be useful as a reference, but may not work on other CentOS releases. If available, we strongly recommend using a guide written for the version of CentOS you are using.
The following DigitalOcean tutorial may be of immediate interest, as it outlines installing Nginx on a CentOS 7 server:
nginx is a high performance web server software. It is a much more flexible and lightweight program than apache.
The steps in this tutorial require the user to have root privileges. You can see how to set that up in the CentOS Initial Server Setup Tutorial in steps 3 and 4.
EPEL stands for Extra Packages for Enterprise Linux. Because yum as a package manager does not include the latest version of nginx in its default repository, installing EPEL will make sure that nginx on CentOS stays up to date.
To install EPEL, open terminal and type in:
sudo yum install epel-release
To install nginx, open terminal and type in:
sudo yum install nginx
After you answer yes to the prompt twice (the first time relates to importing the EPEL gpg-key), nginx will finish installing on your virtual private server.
nginx does not start on its own. To get nginx running, type:
sudo /etc/init.d/nginx start
You can confirm that nginx has installed on your VPS by directing your browser to your IP address.
You can run the following command to reveal your server’s IP address.
ifconfig eth0 | grep inet | awk '{ print $2 }'
On the page, you will see the words, “Welcome to nginx”
Congratulations! You have now installed nginx.
Once you have nginx installed on your cloud server, you can go on to install the Lemp Stack or Set Up a FTP Server
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
http://wiki.nginx.org/Install
After successfully installed nginx, I check it by
But it return:
is it OK? if not, what problem happened? how can I fix it?
Failed! it shows: Error: Package: 1:nginx-1.10.1-1.el7.ngx.x86_64 (nginx) Requires: libc.so.6(GLIBC_2.14)(64bit) Error: Package: 1:nginx-1.10.1-1.el7.ngx.x86_64 (nginx) Requires: libpcre.so.1()(64bit) Error: Package: 1:nginx-1.10.1-1.el7.ngx.x86_64 (nginx) Requires: systemd You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
Anyone help please?
It should be noted in this tutorial that the following IP Tables rule would need to be updated as CentOS comes with a block to the port.
I am using CentOS 7, I don’t think that this should make any difference, but nginx does start by itself after installation and do not create the service in /etc/init.d
How can i upgrade my nginx 1.0.15 to the latest version 1.8 ?
Any reason to use
rpm -Uhv <url>
?This seemed to work for me.
maybe an update as nginx.org has official yum packages for a while now at http://nginx.org/en/linux_packages.html#mainline
or for non-yum folks can do Nginx source compile which I prefer for ngx_pagespeed integration I use Centmin Mod LEMP stack
@bnqtoan: You can uninstall nginx and then use nginx’s official CentOS repo instead: <a href=“http://nginx.org/en/linux_packages.html”>http://nginx.org/en/linux_packages.html</a>.
How can I upgrade my nginx? Thanks for your help!