How to install Nginx on CentOS
Nginx is a free, open-source, high-performance HTTP known for its stability, rich feature set, simple configuration, and low resource consumption.
To install Nginx using yum we will need to include the EPEL (Extra Packages for Enterprise Linux) repository.
One thing to keep in mind when adding extra repositories is that many include newer versions of packages that are readily available through the standard channels. This can cause problems as packages can be automatically upgraded and cease to function as expected.
EPEL repository is purely complimentary and only provides additional packages otherwise unavailable through the default repositories.
Installing the EPEL repository
The command will depend on your CentOS version and the machine type (32 or 64 bit):
cat /etc/redhat-release; uname -m
Now, depending on the output, install the EPEL repository:CentOS 5.x i386:
sudo rpm -ivh http://mirror.yandex.ru/epel/5/i386/epel-release-5-4.noarch.rpmCentOS 5.x x86_64:
sudo rpm -ivh http://mirror.yandex.ru/epel/5/x86_64/epel-release-5-4.noarch.rpmCentOS 6.x i386:
sudo rpm -ivh http://mirror.yandex.ru/epel/6/i386/epel-release-6-8.noarch.rpmCentOS 6.x x86_64:
sudo rpm -ivh http://mirror.yandex.ru/epel/6/x86_64/epel-release-6-8.noarch.rpm
Installing Nginx using Yum
Installing nginx using Yum is now very simple, thanks to EPEL, run:
sudo yum install nginx
As this will be the first package we install using EPEL, we will be asked to import the EPEL gpg-key.
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 Importing GPG key 0x0608B895: Userid : EPEL (6) Package: epel-release-6-5.noarch (installed) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 Is this ok [y/N]: y
This key is used to sign all packages that are associated with the EPEL repository to verify their validity.
Once the gpg-key has been imported, the installation should proceed as expected.
Nginx is not started automatically, to start Nginx run:
# sudo /etc/init.d/nginx start
To check if it works navigate to your IP address:
To start Nginx on boot run:
sudo /sbin/chkconfig nginx on
Controlling Nginx is done with these commands:
sudo /etc/init.d/nginx start ... sudo /etc/init.d/nginx stop ... sudo /etc/init.d/nginx reload ... sudo /etc/init.d/nginx restart
You can also check the current status as well as the configuration syntax by using the following commands:
sudo /etc/init.d/nginx status ... sudo /etc/init.d/nginx configtest
The configtest option is particularly useful for testing your Nginx configuration before actually applying it with a reload or restart.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Hi, worked as planned, thanks, however when I now run the Plesk updater I get this message. Would you be able to advise: WARNING: Third-party Yum repository epel' is enabled, installation may fail.
Since you use one or more 3rd-party repos (say, atomic), be careful when installing different package versions from different repos as this may lead to installation failures. For example, you may encounter a problem if you first install PHP from a 3rd-party repo and then upgrade it using the Parallels repo. To avoid such situations, install and upgrade packages from the same repo. Thanks!
I'm running 1.8.10-1 on CentOS 6 and have the same prlbeom. However, when I make the change you suggest, I get the following error:Incorrect item key Zabbix Server:proc.num[zabbix_server_mysql] provided for trigger expression.Incorrect item key Template_Linux:proc.num[zabbix_server_mysql] provided for trigger expression.Any suggestions?
Got a comment?
All Rights Reserved.