AMP AMP

How to install Nginx 1.17.0 v on CentOS 7.6

Installation of Nginx 1.17.0 v On CentOS 7.6

Installation

Nginx Repository Package:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

Add the repository of nginx server by executing the following command.

[root@linuxhelp ~]# vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

Install the nginx after the successful addition of repository

[root@linuxhelp ~]# yum install nginx -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: repos.del.extreme-ix.org
 * epel: repos.del.extreme-ix.org
 * extras: repos.del.extreme-ix.org
 * remi-php72: mirror.neolabs.kz
 * remi-safe: mirror.neolabs.kz
 * updates: repos.del.extreme-ix.org
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.17.0-1.el7.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================
 Package             Arch                 Version                             Repository           Size
========================================================================================================
Installing:
 nginx               x86_64               1:1.17.0-1.el7.ngx                  nginx               767 k

Transaction Summary
========================================================================================================
Install  1 Package

Total download size: 767 k
Installed size: 2.7 M
Downloading packages:
nginx-1.17.0-1.el7.ngx.x86_64.rpm                                                | 767 kB  00:00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:nginx-1.17.0-1.el7.ngx.x86_64                                                      1/1 
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:

http://nginx.org/en/docs/

Please subscribe to nginx-announce mailing list to get the most important news about nginx:

http://nginx.org/en/support.html

Commercial subscriptions for nginx are available on:

http://nginx.com/products/

----------------------------------------------------------------------
  Verifying  : 1:nginx-1.17.0-1.el7.ngx.x86_64                                                      1/1 

Installed:
  nginx.x86_64 1:1.17.0-1.el7.ngx                                                                       

Complete!

Enable the service of nginx server

[root@linuxhelp ~]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

And then start the service of nginx server.

[root@linuxhelp ~]# systemctl start nginx

Stop the service of nginx server

[root@linuxhelp ~]# systemctl stop nginx

Now restart the service of nginx server

[root@linuxhelp ~]# systemctl restart nginx
[root@linuxhelp ~]# systemctl status  nginx
● nginx.service - nginx - high performance web server
  Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
  Active: active (running) since Tue 2019-06-04 10:10:44 IST; 14s ago
    Docs: http://nginx.org/en/docs/
 Process: 31701 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
 Process: 31728 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Main PID: 31729 (nginx)

Check the port number that has been allotted to nginx server using grep as follows

[root@linuxhelp ~]# netstat -tulpn | grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      32430/nginx: master 

Check the version of nginx as follows

[root@linuxhelp ~]# nginx -v
nginx version: nginx/1.17.0

Open the browser and enter the ip address of the system or simply as localhost to test the nginx welcome page With this, Installation of Nginx server 1.17.0 v On CentOS 7.6 comes to end.

Tag : Nginx CentOS
Comment
dmitriykelnmaarikeln
Sep 12 2019
You are forget about this:
$ sudo yum remove nginx-mod*

The install the modules provided by the official repository:
$ sudo yum install nginx-module-*

If you don’t want to install all the modules replace the wildcard with the specific module(s) you want. The modules can be found using sudo yum search nginx-module

And restart the server:
$ sudo systemctl restart nginx

without this actions nginx was failed when restart
Add a comment
FAQ
Q
Which architecture does Nginx server use?
A
Nginx server uses event-driven architecture specifically to address the performance and scalability of issues.
Q
Does the Nginx server has the ability to process dynamic content internally?
A
Nginx server lacks the ability to process dynamic content internally.
Q
How is Nginx server different from Apache?
A
Nginx server is a high-performance asynchronous web server and reverses proxy server whereas Apache is an open-source HTTP server.
Q
Is an nginx server faster than Apache?
A
yes, Nginx server is two times faster than Apache.
Q
What is a nginx server?
A
Nginx server is a free,open source,high performance HTTP server and reverse proxy. as well as an IMAP/POP3 proxy server which is well known for its high performance,stability,rich feature set,simple configuration and low resource consumption.