CentOS: [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1 RHEL: [nginx] name=nginx repo baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/ gpgcheck=0 enabled=1
[root@app-node1 ~]# yum install nginx
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package nginx.i386 0:0.8.55-2.el5 set to be updated
--> Processing Dependency: libGeoIP.so.1 for package: nginx
--> Running transaction check
---> Package GeoIP.i386 0:1.4.8-1.el5 set to be updated
--> Finished Dependency Resolution
....
Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: nginx i386 0.8.55-2.el5 epel 390 k Installing for dependencies: GeoIP i386 1.4.8-1.el5 epel 781 k Transaction Summary ================================================================================ Install 2 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 1.1 M Is this ok [y/N]: Y
If you encounter dependency issues while installing through yum you can solve that by searching the dependency package or library file(with .so extension) in pkgs.org and then downloading and installing that package for your respective version of OS, by rpm command.
Installing Nginx from Source
first of all download the source package from here
[root@app-node1 ~]# tar -xvf nginx-1.2.4.tar.gz
Now you will have a directory named nginx-1.2.4.tar.gz in the location where you unzipped the .gz package file.
[root@app-node1 nginx-1.2.4]# ls auto CHANGES.ru configure html man src CHANGES conf contrib LICENSE README
Let’s configure our Nginx installation with ./configure command. There is any number of options available with this ./configure command, like the following.
[root@app-node1 nginx-1.2.4]# ./configure --prefix=/home/sshinde/ --pid-path=/etc/nginx/nginx.pid --http-log-path=/var/log/nginx_access_log --with-pcre=/etc/nginx/pcre --with-zlib=/etc/nginx/zlib [root@app-node1 nginx-1.2.4]# ./configure --prefix=/home/sshinde/ --pid-path=/etc/nginx/nginx.pid --http-log-path=/var/log/nginx_access_log --without-http_rewrite_module --without-http_gzip_module
[root@app-node1 nginx-1.2.4]# make
[root@app-node1 nginx-1.2.4]# make install
[root@app-node1 ~]# /home/sshinde/sbin/nginx
I have installed it in /home/sshinde which is the reason I am using this path to start Nginx. Let‘s confirm whether our Nginx is running by the following command.
[root@app-node1 ~]# lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME nginx 5850 root 6u IPv4 52188 TCP *:http (LISTEN)
[root@app-node1 ~]# ps aux | grep nginx root 5850 0.0 0.1 2600 984 ? Ss 10:00 0:00 nginx: master process /home/sshinde/sbin/nginx nobody 5890 0.0 0.1 2748 896 ? S 10:01 0:00 nginx: worker process
[root@app-node1 ~]# cat /etc/nginx/nginx.pid 5850
Command to start/stop/restart NGINX Service in Linux
[root@app-node1 ~]# sudo service nginx stop
[root@app-node1 ~]# sudo service nginx start
[root@app-node1 ~]# sudo service nginx restart
this is the end of tutorials, we explained How to install Nginx in RHEL and CentOS.
Thanks for reading these articles and you’ll also like.
Steps to Manage logs in Linux using Logrotate
Step By Step Method for installing Nagios in Amazon Linux
How to Install and Configure Cacti on Ubuntu 18 LTS
How to Install and Configure HAProxy on CentOS or Amazon Linux
good explanation