Friday, May 29, 2026

DevOps

 1) Installation of Nginx in Redhat Enterprise Linux 8.10

Installation of nginx in red hat linux 8.10

[root@192 ~]# dnf -y update

Updating Subscription Management repositories.

Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                      3.3 MB/s |  85 MB     00:25

Red Hat Enterprise Linux 8 for x86_64 - Bas 61% [==========================                 ] 2.7 MB/s |  84 MB     00:20 ETA

[root@192 ~]# dnf -y install nginx

[root@192 ~]# dnf search nginx

[root@192 ~]# systemctl list-unit

list-unit-files  list-units

[root@192 ~]# systemctl list-unit-files | grep nginx

nginx.service                              disabled

[root@192 ~]# systemctl list-units | grep nginx

[root@192 ~]# systemctl enable nginx

Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.

[root@192 ~]# systemctl start nginx

[root@192 ~]# systemctl list-units | grep nginx

nginx.service                                                                                    loaded active running   The nginx HTTP and reverse proxy server

[root@192 ~]# firewall-cmd --list-all

[root@192 ~]# firewall-cmd --add-service=http --permanent

Success

[root@192 ~]# firewall-cmd --reload

success

[root@192 ~]# firewall-cmd --list-all

 

[root@192 ~]# getenforce

Enforcing

[root@192 ~]# setenforce 0

[root@192 ~]# getenforce

Permissive

[root@192 ~]# mkdir -p /var/www/html/testweb

[root@192 ~]# cd /var/www/html/testweb/

[root@192 testweb]# ls

[root@192 testweb]# cd ~

[root@192 ~]# vi /etc/nginx/conf.d/web.conf

server {

listen 80;

server_name mywebsite.com.np;

root /var/www/html/testweb;

index index.html;

}

 

For this file  reference is 

[root@192 ~]# cat /etc/nginx/nginx.conf

[root@192 ~]# firefox mywebsite.com.np

Safe Browsing server returned a 400 during update:request url = https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$ct=application/x-protobuf&key=AIzaSyBPGXa4AYD4FC3HJK7LnIKxm4fDusVuuco&$httpMethod=POST, payload = ChUKE25hdmNsaWVudC1hdXRvLWZmb3gaCggFEAIiAiACKAEaCggBEAIiAiACKAEaCggDEAIiAiACKAEaCggHEAIiAiACKAEaCggJEAIiAiACKAE=

[root@192 ~]# vi /etc/hosts

192.168.184.133  mywebsite.com.np

[root@192 ~]# systemctl reload nginx

[root@192 ~]# firefox mywebsite.com.np

Safe Browsing server returned a 400 during update:request url = https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$ct=application/x-protobuf&key=AIzaSyBPGXa4AYD4FC3HJK7LnIKxm4fDusVuuco&$httpMethod=POST, payload = ChUKE25hdmNsaWVudC1hdXRvLWZmb3gaCggFEAIiAiACKAEaCggBEAIiAiACKAEaCggDEAIiAiACKAEaCggHEAIiAiACKAEaCggJEAIiAiACKAE

403 Forbidden means Nginx is running but can't access your website files. This is a permissions issue.

[root@192 ~]# cat /var/log/nginx/error.log

The error is clear — no index file found in your web directory.

[root@192 ~]# nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

[root@192 ~]# ping mywebsite.com.np

PING mywebsite.com.np (192.168.184.133) 56(84) bytes of data.

64 bytes from mywebsite.com.np (192.168.184.133): icmp_seq=1 ttl=64 time=0.093 ms

64 bytes from mywebsite.com.np (192.168.184.133): icmp_seq=2 ttl=64 time=0.086 ms

64 bytes from mywebsite.com.np (192.168.184.133): icmp_seq=3 ttl=64 time=0.123 ms

^C

--- mywebsite.com.np ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2085ms

rtt min/avg/max/mdev = 0.086/0.100/0.123/0.019 ms

[root@192 ~]# vi /etc/nginx/conf.d/web.conf

[root@192 ~]# curl mywebsite.com.np

<html>

<head><title>403 Forbidden</title></head>

<body bgcolor="white">

<center><h1>403 Forbidden</h1></center>

<hr><center>nginx/1.14.1</center>

</body>

</html>

Solution make index .html file

root@192 html]# cd testweb/

[root@192 testweb]# vi index.html

<html>

<body>

    <h1>Hello, World!</h1>

</body>

</html>

 

[root@192 testweb]# firewall-cmd --reload

success

[root@192 testweb]# systemctl reload nginx

[root@192 testweb]# firefox mywebsite.com.np

To append used >>

[root@192 testweb]# echo "website" >> index.html

[root@192 testweb]# firefox http://mywebsite.com.np

dnf -y install unzip

Updating Subscription Management repositories.

Last metadata expiration check: 0:58:44 ago on Sat 04 Jul 2026 06:51:54 AM EDT.

Package unzip-6.0-48.el8_10.x86_64 is already installed.

Dependencies resolved.

Nothing to do.

Complete!

Dnf install unzip

[root@192 ~]# cd /root/

[root@192 ~]# ls

anaconda-ks.cfg  Downloads  initial-setup-ks.cfg

[root@192 ~]# cd Downloads/

[root@192 Downloads]# ls

templatemo_574_mexant.zip

[root@192 Downloads]#  unzip -j templatemo_574_mexant.zip -d /var/www/html/testweb/                                           Archive:  templatemo_574_mexant.zip

  inflating: /var/www/html/testweb/about-us.html

  inflating: /var/www/html/testweb/animate.css

  inflating: /var/www/html/testweb/flex-slider.css

 

[root@192 Downloads]# systemctl reload nginx

[root@192 Downloads]# systemctl restart nginx

[root@192 Downloads]# firewall-cmd --reload

success

[root@192 Downloads]# firefox http://mywebsite.com.np

 

 

Problem: css not working

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2) SSL  in Redhat Enterprise Linux 8.10

 

 

 

 

No comments:

Post a Comment