{"id":71,"date":"2014-09-19T03:16:00","date_gmt":"2014-09-19T03:16:00","guid":{"rendered":"http:\/\/onlinelab.info\/2014\/09\/19\/rhel-centos-6-install-nginx-using-yum-command\/"},"modified":"2014-09-19T03:16:00","modified_gmt":"2014-09-19T03:16:00","slug":"rhel-centos-6-install-nginx-using-yum-command","status":"publish","type":"post","link":"https:\/\/www.asianux.org.vn\/index.php\/2014\/09\/19\/rhel-centos-6-install-nginx-using-yum-command\/","title":{"rendered":"RHEL \/ Centos 6: Install Nginx Using Yum Command"},"content":{"rendered":"<p><span style=\"background-color: white; color: #888888; float: left; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 3.571em; line-height: 0.76em; margin: 0px; padding: 0.04em 0.12em 0px 0px;\">H<\/span><span style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px;\">ow can I install Nginx web server On CentOS Linux 6 or Red Hat Enterprise Linux 6 using yum command?<\/span><br style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px; padding: 0px;\" \/><span style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px; padding: 0px;\"><\/span><\/p>\n<div style=\"background-color: white; color: #111111; float: right; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px 0px 0px 5px; padding: 0px;\">\n<table cellspacing=\"0\" style=\"-webkit-box-shadow: rgb(209, 209, 209) 0px 1px 2px; background: rgb(234, 235, 236); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); box-shadow: rgb(209, 209, 209) 0px 1px 2px; color: #666666; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin: 1px; padding: 0px; text-shadow: rgb(255, 255, 255) 1px 1px 0px;\">\n<tbody style=\"margin: 0px; padding: 0px;\">\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<th style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(237, 237, 237)), to(rgb(235, 235, 235))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(250, 250, 250); border-top-left-radius: 3px; border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 5px 9px 6px 20px; text-align: left;\">Tutorial details<\/th>\n<th style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(237, 237, 237)), to(rgb(235, 235, 235))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(250, 250, 250); border-top-right-radius: 3px; border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 5px 9px 6px;\"><\/th>\n<\/tr>\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(251, 251, 251)), to(rgb(250, 250, 250))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-width: 0px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px 2px 2px 20px; text-align: left;\">Difficulty<\/td>\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(251, 251, 251)), to(rgb(250, 250, 250))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(224, 224, 224); border-left-style: solid; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/tutorial-difficulty-level\/intermediate\/\" style=\"color: #2361a1; font-weight: bold; margin: 0px; padding: 0px; text-decoration: none;\" title=\"See all Intermediate Linux \/ Unix System Administrator Tutorials\" target=\"_blank\" rel=\"noopener\">Intermediate<\/a>&nbsp;(<a href=\"http:\/\/www.cyberciti.biz\/faq\/tutorial-difficulty-level\/intermediate\/feed\/\" style=\"color: #2361a1; font-weight: bold; margin: 0px; padding: 0px; text-decoration: none;\" title=\"See all Intermediate Linux \/ Unix System Administrator Tutorials via rss feed\" target=\"_blank\" rel=\"noopener\">rss<\/a>)<\/td>\n<\/tr>\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(248, 248, 248)), to(rgb(246, 246, 246))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-width: 0px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px 2px 2px 20px; text-align: left;\">Root privileges<\/td>\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(248, 248, 248)), to(rgb(246, 246, 246))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(224, 224, 224); border-left-style: solid; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/how-can-i-log-in-as-root\/\" style=\"color: #2361a1; font-weight: bold; margin: 0px; padding: 0px; text-decoration: none;\" title=\"See how to login as root user\" target=\"_blank\" rel=\"noopener\">Yes<\/a><\/td>\n<\/tr>\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(251, 251, 251)), to(rgb(250, 250, 250))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-width: 0px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px 2px 2px 20px; text-align: left;\">Requirements<\/td>\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(251, 251, 251)), to(rgb(250, 250, 250))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(224, 224, 224); border-left-style: solid; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px;\">CentOS\/RHEL<br style=\"margin: 0px; padding: 0px;\" \/>yum<\/td>\n<\/tr>\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(248, 248, 248)), to(rgb(246, 246, 246))); border-bottom-left-radius: 3px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px 2px 2px 20px; text-align: left;\">Estimated completion time<\/td>\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(248, 248, 248)), to(rgb(246, 246, 246))); border-bottom-right-radius: 3px; border-bottom-width: 0px; border-left-color: rgb(224, 224, 224); border-left-style: solid; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px;\">N\/A<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><br style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px; padding: 0px;\" \/><span style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px;\">Recently, nginx web project started to distribute binary packages using nginx yum repository. You can either create \/etc\/yum.repos.d\/nginx.repo or directly install rpm package. This package contains yum configuration file and a public PGP key necessary to authenticate signed RPMs.<\/span><\/p>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\"><\/div>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">Step #1: Install nginx repo<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Type the following wget command to install nginx yum configuration<br \/>\nfile:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># cd \/tmp<\/code><br style=\"margin: 0px; padding: 0px;\" \/>CentOS Linux v6.x user type the following command:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># wget http:\/\/nginx.org\/packages\/centos\/6\/noarch\/RPMS\/nginx-release-centos-6-0.el6.ngx.noarch.rpm<br style=\"margin: 0px; padding: 0px;\" \/># rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm<\/code><br style=\"margin: 0px; padding: 0px;\" \/>RHEL v6.x user type the following command:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># wget http:\/\/nginx.org\/packages\/rhel\/6\/noarch\/RPMS\/nginx-release-rhel-6-0.el6.ngx.noarch.rpm<br style=\"margin: 0px; padding: 0px;\" \/># rpm -ivh nginx-release-rhel-6-0.el6.ngx.noarch.rpm<\/code><br style=\"margin: 0px; padding: 0px;\" \/>Sample outputs:<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">warning: nginx-release-rhel-6-0.el6.ngx.noarch.rpm: Header V4 RSA\/SHA1 Signature, key ID 7bd9bf62: NOKEY<br \/>Preparing...                ########################################### [100%]<br \/>   1:nginx-release-rhel     ########################################### [100%]<br \/><\/pre>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">Step #2: Install nginx web-server<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Type the following yum command to install nginx web-server:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># yum install nginx<\/code><br style=\"margin: 0px; padding: 0px;\" \/>Sample outputs:<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">Loaded plugins: product-id, rhnplugin, security, subscription-manager<br \/>Updating certificate-based repositories.<br \/>Unable to read consumer identity<br \/>nginx                                                    | <span style=\"margin: 0px; padding: 0px;\">1.3<\/span> kB     <span style=\"margin: 0px; padding: 0px;\">00<\/span>:<span style=\"margin: 0px; padding: 0px;\">00<\/span><br \/>nginx\/primary                                            | <span style=\"margin: 0px; padding: 0px;\">4.8<\/span> kB     <span style=\"margin: 0px; padding: 0px;\">00<\/span>:<span style=\"margin: 0px; padding: 0px;\">00<\/span><br \/>nginx                                                                     <span style=\"margin: 0px; padding: 0px;\">33<\/span>\/<span style=\"margin: 0px; padding: 0px;\">33<\/span><br \/>Setting up Install Process<br \/>Resolving Dependencies<br \/>--&gt; Running transaction check<br \/>---&gt; Package nginx.x86_64 <span style=\"margin: 0px; padding: 0px;\">0<\/span>:<span style=\"margin: 0px; padding: 0px;\">1.2<\/span><span style=\"margin: 0px; padding: 0px;\">.6<\/span><span style=\"margin: 0px; padding: 0px;\">-1<\/span>.el6.ngx will be installed<br \/>--&gt; Finished Dependency Resolution<br \/>&nbsp;<br \/>Dependencies <span style=\"color: #000099; margin: 0px; padding: 0px;\">Resolved<br \/>&nbsp;<br \/><\/span>=<span style=\"color: #660066; margin: 0px; padding: 0px;\">===============================================================================<\/span><br \/> Package        Arch            Version                    Repository      <span style=\"color: #000099; margin: 0px; padding: 0px;\">Size<br \/><\/span>=<span style=\"color: #660066; margin: 0px; padding: 0px;\">===============================================================================<\/span><br \/>Installing:<br \/> nginx          x86_64          <span style=\"margin: 0px; padding: 0px;\">1.2<\/span><span style=\"margin: 0px; padding: 0px;\">.6<\/span><span style=\"margin: 0px; padding: 0px;\">-1<\/span>.el6.ngx            nginx          <span style=\"margin: 0px; padding: 0px;\">361<\/span> k<br \/>&nbsp;<br \/>Transaction <span style=\"color: #000099; margin: 0px; padding: 0px;\">Summary<br \/><\/span>=<span style=\"color: #660066; margin: 0px; padding: 0px;\">===============================================================================<\/span><br \/>Install       <span style=\"margin: 0px; padding: 0px;\">1<\/span> Package<span style=\"margin: 0px; padding: 0px;\">(<\/span>s<span style=\"margin: 0px; padding: 0px;\">)<\/span><br \/>&nbsp;<br \/>Total download size: <span style=\"margin: 0px; padding: 0px;\">361<\/span> k<br \/>Installed size: <span style=\"margin: 0px; padding: 0px;\">835<\/span> k<br \/>Is this ok <span style=\"color: #000066; font-weight: bold; margin: 0px; padding: 0px;\"><span style=\"margin: 0px; padding: 0px;\">[<\/span>y\/N<span style=\"margin: 0px; padding: 0px;\">]<\/span><\/span>: y<br \/>Downloading Packages:<br \/>nginx<span style=\"margin: 0px; padding: 0px;\">-1.2<\/span><span style=\"margin: 0px; padding: 0px;\">.6<\/span><span style=\"margin: 0px; padding: 0px;\">-1<\/span>.el6.ngx.x86_64.rpm                         | <span style=\"margin: 0px; padding: 0px;\">361<\/span> kB     <span style=\"margin: 0px; padding: 0px;\">00<\/span>:<span style=\"margin: 0px; padding: 0px;\">00<\/span><br \/>Running rpm_check_debug<br \/>Running Transaction Test<br \/>Transaction Test Succeeded<br \/>Running Transaction<br \/>Warning: RPMDB altered outside of yum.<br \/>  Installing : nginx<span style=\"margin: 0px; padding: 0px;\">-1.2<\/span><span style=\"margin: 0px; padding: 0px;\">.6<\/span><span style=\"margin: 0px; padding: 0px;\">-1<\/span>.el6.ngx.x86_64                                 <span style=\"margin: 0px; padding: 0px;\">1<\/span>\/<span style=\"margin: 0px; padding: 0px;\">1<\/span><br \/>----------------------------------------------------------------------<br \/>&nbsp;<br \/>Thanks for using NGINX!<br \/>&nbsp;<br \/>Check out our community web site:<br \/>* http:\/\/nginx.org\/en\/support.html<br \/>&nbsp;<br \/>If you have questions about commercial support for NGINX please visit:<br \/>* http:\/\/www.nginx.com\/support.html<br \/>&nbsp;<br \/>----------------------------------------------------------------------<br \/>Installed products updated.<br \/>  Verifying  : nginx<span style=\"margin: 0px; padding: 0px;\">-1.2<\/span><span style=\"margin: 0px; padding: 0px;\">.6<\/span><span style=\"margin: 0px; padding: 0px;\">-1<\/span>.el6.ngx.x86_64                                 <span style=\"margin: 0px; padding: 0px;\">1<\/span>\/<span style=\"margin: 0px; padding: 0px;\">1<\/span><br \/>&nbsp;<br \/>Installed:<br \/>  nginx.x86_64 <span style=\"margin: 0px; padding\n: 0px;\">0<\/span>:<span style=\"margin: 0px; padding: 0px;\">1.2<\/span><span style=\"margin: 0px; padding: 0px;\">.6<\/span><span style=\"margin: 0px; padding: 0px;\">-1<\/span>.el6.ngx<br \/>&nbsp;<br \/>Complete!<br \/>&nbsp;<\/pre>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">Step #3: Turn on nginx service<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Type the following command:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># chkconfig nginx on<\/code><\/div>\n<h3 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; font-weight: normal; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">How do I start \/ stop \/ restart nginx web-server?<\/h3>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Type the following commands:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># service nginx start<br style=\"margin: 0px; padding: 0px;\" \/># service nginx stop<br style=\"margin: 0px; padding: 0px;\" \/># service nginx restart<br style=\"margin: 0px; padding: 0px;\" \/># service nginx status<br style=\"margin: 0px; padding: 0px;\" \/># service nginx reload<\/code><\/div>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">Step #4: Configuration files<\/h2>\n<ol style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px 0px 1.571em 1.571em; padding: 0px;\">\n<li style=\"margin: 0px; padding: 0px;\">Default configuration directory:&nbsp;<kbd style=\"margin: 0px; padding: 0px;\">\/etc\/nginx\/<\/kbd><\/li>\n<li style=\"margin: 0px; padding: 0px;\">Default SSL and vhost config directory:&nbsp;<kbd style=\"margin: 0px; padding: 0px;\">\/etc\/nginx\/conf.d\/<\/kbd><\/li>\n<li style=\"margin: 0px; padding: 0px;\">Default log file directory:&nbsp;<kbd style=\"margin: 0px; padding: 0px;\">\/var\/log\/nginx\/<\/kbd><\/li>\n<li style=\"margin: 0px; padding: 0px;\">Default document root directory:&nbsp;<kbd style=\"margin: 0px; padding: 0px;\">\/usr\/share\/nginx\/html<\/kbd><\/li>\n<li style=\"margin: 0px; padding: 0px;\">Default configuration file:&nbsp;<kbd style=\"margin: 0px; padding: 0px;\">\/etc\/nginx\/nginx.conf<\/kbd><\/li>\n<li style=\"margin: 0px; padding: 0px;\">Default server access log file:&nbsp;<kbd style=\"margin: 0px; padding: 0px;\">\/var\/log\/nginx\/access.log<\/kbd><\/li>\n<li style=\"margin: 0px; padding: 0px;\">Default server access log file:&nbsp;<kbd style=\"margin: 0px; padding: 0px;\">\/var\/log\/nginx\/error.log<\/kbd><\/li>\n<\/ol>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">To edit the nginx configuration file, enter:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># vi \/etc\/nginx\/nginx.conf<\/code><br style=\"margin: 0px; padding: 0px;\" \/>Set or update worker_processes as follows (this must be set to CPU(s) in your system. Use the<a href=\"http:\/\/www.cyberciti.biz\/faq\/install-nginx-centos-rhel-6-server-rpm-using-yum-command\/\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" target=\"_blank\" rel=\"noopener\">lscpu | grep &#8216;^CPU(s)&#8217;<\/a>&nbsp;command to list the number of CPUs in the server)<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">worker_processes  2;<\/pre>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Turn on gzip support:<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">gzip  on<span style=\"color: #666666; font-style: italic; margin: 0px; padding: 0px;\">;<\/span><\/pre>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Save and close the file. Edit the file&nbsp;<kbd style=\"margin: 0px; padding: 0px;\">\/etc\/nginx\/conf.d\/default.conf<\/kbd>, enter:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># vi \/etc\/nginx\/conf.d\/default.conf<\/code><br style=\"margin: 0px; padding: 0px;\" \/>Set IP address and TCP port number:<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">    listen       <span style=\"margin: 0px; padding: 0px;\">202.54<\/span><span style=\"margin: 0px; padding: 0px;\">.1<\/span><span style=\"margin: 0px; padding: 0px;\">.1<\/span><span style=\"margin: 0px; padding: 0px;\">.1<\/span>:<span style=\"margin: 0px; padding: 0px;\">80<\/span><span style=\"color: #666666; font-style: italic; margin: 0px; padding: 0px;\">;<\/span><\/pre>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Set server name:<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">    server_name  www.cyberciti.biz;<\/pre>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Save and close the file. Start the server:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-fami\nly: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># service nginx start<\/code><br style=\"margin: 0px; padding: 0px;\" \/>Verify that everything is working:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># netstat -tulpn | grep :80<br style=\"margin: 0px; padding: 0px;\" \/># ps aux | grep nginx<\/code><\/div>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">Firewall configuration: Open TCP port # 80<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Edit the file \/etc\/sysconfig\/iptables, enter:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># vi \/etc\/sysconfig\/iptables<\/code><br style=\"margin: 0px; padding: 0px;\" \/>Add the following lines, ensuring that they appear before the final LOG and DROP lines for the INPUT chain to open port 80:<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">&nbsp;<br \/>-A INPUT -m state --state NEW -p tcp --dport <span style=\"color: black; margin: 0px; padding: 0px;\">80<\/span> -j ACCEPT<br \/>&nbsp;<\/pre>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Save and close the file. Finally, restart the firewall:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\"># service iptables restart<\/code><\/div>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">How do I configure nginx+php5?<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">See&nbsp;<a href=\"http:\/\/www.cyberciti.biz\/faq\/rhel-fedora-install-configure-nginx-php5\/\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" target=\"_blank\" rel=\"noopener\">this tutorial for more information<\/a>.<\/div>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">How do I configure Nginx as a reverse proxy server?<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">See our previous tutorials:<\/div>\n<ol style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px 0px 1.571em 1.571em; padding: 0px;\">\n<li style=\"margin: 0px; padding: 0px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/rhel-centos-fedora-keepalived-lvs-cluster-configuration\/\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" title=\"CentOS \/ Redhat Linux: Install Keepalived To Provide IP Failover For Web Cluster\" target=\"_blank\" rel=\"noopener\">CentOS \/ Redhat Linux: Install Keepalived To Provide IP Failover For Web Cluster<\/a><\/li>\n<li style=\"margin: 0px; padding: 0px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/rhel-linux-install-nginx-as-reverse-proxy-load-balancer\/\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" title=\"CentOS \/ Redhat: Install nginx As Reverse Proxy Load Balancer\" target=\"_blank\" rel=\"noopener\">CentOS \/ Redhat: Install nginx As Reverse Proxy Load Balancer<\/a><\/li>\n<li style=\"margin: 0px; padding: 0px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/handling-nginx-failover-with-keepalived\/\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" title=\"Handling nginx Failover With KeepAlived\" target=\"_blank\" rel=\"noopener\">Handling nginx Failover With KeepAlived<\/a><\/li>\n<li style=\"margin: 0px; padding: 0px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/howto-linux-unix-setup-nginx-ssl-proxy\/\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" target=\"_blank\" rel=\"noopener\">nginx: Setup SSL Reverse Proxy (Load Balanced SSL Proxy)<\/a><\/li>\n<li style=\"margin: 0px; padding: 0px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/nginx-extract-the-clients-real-ip-from-x-forwarded-for-header\/\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" title=\"mod_extforward: Lighttpd Log Clients Real IP Behind Reverse Proxy \/ Load Balancer\" target=\"_blank\" rel=\"noopener\">mod_extforward: Lighttpd Log Clients Real IP Behind Reverse Proxy \/ Load Balancer<\/a><\/li>\n<li style=\"margin: 0px; padding: 0px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/unix-linux-merging-multiple-access-logs-with-logfile-merger\/\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" title=\"HowTo: Merge Apache \/ Lighttpd \/ Nginx Server Log Files\" target=\"_blank\" rel=\"noopener\">HowTo: Merge Apache \/ Lighttpd \/ Nginx Server Log Files<\/a><\/li>\n<li style=\"margin: 0px; padding: 0px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/howto-run-nginx-in-a-chroot-jail\/\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" title=\"Linux nginx: Chroot (Jail) Setup\" target=\"_blank\" rel=\"noopener\">Linux nginx: Chroot (Jail) Setup<\/a><\/li>\n<\/ol>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">How do I secure nginx web-server?<\/h2>\n<ol style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px 0px 1.571em 1.571em; padding: 0px;\">\n<li style=\"margin: 0px; padding: 0px;\">See:&nbsp;<a href=\"http:\/\/www.cyberciti.biz\/tips\/linux-unix-bsd-nginx-webserver-security.html\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" target=\"_blank\" rel=\"noopener\">Top 20 Nginx webServer best security practices<\/a>&nbsp;blog post for more information.<\/li>\n<\/ol>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">Check out related media<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">This tutorial is also available in a quick video format.<\/div>\n<p><center style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px; padding: 0px;\"><br style=\"margin: 0px; padding: 0px;\" \/><iframe loading=\"lazy\" allowfullscreen=\"\" frameborder=\"0\" height=\"334\" src=\"http:\/\/www.youtube.com\/embed\/xRSO1IOkf9M\" style=\"margin: 0px; padding: 0px;\" width=\"593\"><\/iframe><br style=\"margin: 0px; padding: 0px;\" \/><small style=\"margin: 0px; padding: 0px;\">(Video 01:&nbsp;<a href=\"http:\/\/youtu.be\/xRSO1IOkf9M\" style=\"color: #2361a1; margin: 0px;\n padding: 0px;\" target=\"_blank\" rel=\"noopener\">HowTo: Install Nginx On Centos \/ Red Hat Enterprise Linux 6.x&nbsp;<\/a>)<\/small><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How can I install Nginx web server On CentOS Linux 6 or Red Hat Enterprise Linux 6 using yum command? Tutorial details Difficulty Intermediate&nbsp;(rss) Root privileges Yes Requirements CentOS\/RHELyum Estimated completion time N\/A Recently, nginx&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-71","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/71","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/comments?post=71"}],"version-history":[{"count":0,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/71\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/media?parent=71"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/categories?post=71"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/tags?post=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}