How To Install Nginx On OpenSUSE Tumbleweed

How to install Nginx

The use of Nginx in an information technology-based organization is general. Currently, many organizations use Nginx both as a web server and as a reverse proxy. This article will cover the Nginx installation steps on OpenSuse Tumbleweed Linux operating system.

Introduction

In today’s digital landscape, website performance and security are paramount. Slow loading times and vulnerabilities can turn away potential visitors and harm your search engine rankings. To address these challenges, many web developers and administrators turn to NGINX—a powerful open-source web server and reverse proxy server that excels in speed, scalability, and security.

NGINX is renowned for its high-performance architecture, designed to handle a large number of concurrent connections efficiently. Unlike traditional web servers like Apache, NGINX operates on an asynchronous, event-driven model, allowing it to serve static content swiftly and handle dynamic content with ease.

How To Install Nginx On OpenSUSE Tumbleweed

To install Nginx on openSUSE, you can use the zypper package manager. Here’s a step-by-step guide:

  1. Update Package Repository
  2. Install Nginx On OpenSuse
  3. Start Nginx Service
  4. Enable Nginx Service
  5. Check Nginx Status

Update Package Repository

It’s always a good idea to update your package repository to ensure you’re getting the latest version of Nginx. To update package repository on OpenSuse we just submit the following command line :

$ sudo zypper install nginx

Install Nginx

Before installing Nginx, we will search for Nginx package name by using zypper as shown below :

$ zypper search nginx

Output :

ramansah@bckinfobckinfo:~> zypper search nginx
Loading repository data...
Reading installed packages...

S | Name | Summary | Type
--+------------------------------+-------------------------------------------------------------------+--------
| dehydrated-nginx | Nginx Integration for dehydrated | package
| docserv-config-nginx | Configuration files for nginx to serve docserv directory | package
| fcgiwrap-nginx | System services for using fcgiwrap with nginx | package
| nginx | A HTTP server and IMAP/POP3 proxy server | package
| nginx-macros | Just some macros to make packaging nginx and modules easier | package
| nginx-module-brotli | NGINX module for Brotli compression | package
| nginx-module-njs | NGINX module for NGINX Javascript | package
| nginx-module-vts | Nginx virtual host traffic status module | package
| nginx-module-zstd | NGINX module for Zstandard compression | package
| nginx-source | The nginx source | package
| openQA-single-instance-nginx | Convenience package for a single-instance setup using nginx proxy | package
| pagure-web-nginx | Nginx configuration for Pagure | package
| pcp-pmda-nginx | Performance Co-Pilot (PCP) metrics for the Nginx Webserver | package
| python39-azure-mgmt-nginx | Microsoft Azure Nginx Management Client Library for Python | package
| python39-certbot-nginx | Nginx plugin for Certbot | package
| python310-azure-mgmt-nginx | Microsoft Azure Nginx Management Client Library for Python | package
| python310-certbot-nginx | Nginx plugin for Certbot | package
| python311-azure-mgmt-nginx | Microsoft Azure Nginx Management Client Library for Python | package
| python311-certbot-nginx | Nginx plugin for Certbot | package
| python312-azure-mgmt-nginx | Microsoft Azure Nginx Management Client Library for Python | package
| python312-certbot-nginx | Nginx plugin for Certbot | package
| rubygem-passenger-nginx | Passenger Nginx module | package

The Nginx package has been on the system repository, then we will install it by using command line :

$ sudo zypper install nginx

Output :

ramansah@bckinfobckinfo:~> sudo zypper install nginx
[sudo] password for root:
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
nginx

1 new package to install.
Overall download size: 711.6 KiB. Already cached: 0 B. After the operation, additional 2.4 MiB will be used.

Backend: classic_rpmtrans
Continue? [y/n/v/...? shows all options] (y):
Retrieving: nginx-1.25.4-3.1.x86_64 (Main Repository (OSS)) (1/1), 711.6 KiB
Retrieving: nginx-1.25.4-3.1.x86_64.rpm .................................................................[done (1.3 MiB/s)]

Checking for file conflicts: ........................................................................................[done]
/usr/bin/systemd-sysusers --replace=/usr/lib/sysusers.d/nginx.conf -
Creating group 'nginx' with GID 458.
Creating user 'nginx' (User for nginx) with UID 458 and GID 458.
(1/1) Installing: nginx-1.25.4-3.1.x86_64 ...........................................................................[done]
Running post-transaction scripts ....................................................................................[done]
ramansah@bckinfobckinfo:~>
amansah@bckinfobckinfo:~> zypper info nginx
Repository 'Main Repository (NON-OSS)' is out-of-date. You can run 'zypper refresh' as root to update it.
Repository 'Main Repository (OSS)' is out-of-date. You can run 'zypper refresh' as root to update it.
Repository 'Main Update Repository' is out-of-date. You can run 'zypper refresh' as root to update it.
Repository 'Open H.264 Codec (openSUSE Tumbleweed)' is out-of-date. You can run 'zypper refresh' as root to update it.
Loading repository data...
Reading installed packages...


Information for package nginx:
------------------------------
Repository : Main Repository (OSS)
Name : nginx
Version : 1.25.4-3.1
Arch : x86_64
Vendor : openSUSE
Installed Size : 2.4 MiB
Installed : Yes
Status : up-to-date
Source package : nginx-1.25.4-3.1.src
Upstream URL : https://nginx.org
Summary : A HTTP server and IMAP/POP3 proxy server
Description :
nginx [engine x] is a HTTP server and IMAP/POP3 proxy server written by Igor Sysoev.
It has been running on many heavily loaded Russian sites for more than two years.

At this short tutorial, we use Nginx version 1.25, as shown above.

Start Nginx Service

After Nginx installation is completed done, then we will start it and show the Nginx services by using following commands line :

$ sudo systemctl start nginx
$ sudo systemctl status nginx

Output :

ramansah@bckinfobckinfo:~> sudo systemctl start nginx 
ramansah@bckinfobckinfo:~> sudo systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; preset: disabled)
Active: active (running) since Sat 2024-03-30 00:06:45 WIB; 8s ago
Process: 81986 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Main PID: 81988 (nginx)
Tasks: 2 (limit: 4579)
CPU: 82ms
CGroup: /system.slice/nginx.service
├─81988 "nginx: master process /usr/sbin/nginx -g daemon off;"
└─81991 "nginx: worker process"

Mar 30 00:06:45 bckinfobckinfo.com systemd[1]: Starting The nginx HTTP and reverse proxy server...
Mar 30 00:06:45 bckinfobckinfo.com nginx[81986]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Mar 30 00:06:45 bckinfobckinfo.com nginx[81986]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Mar 30 00:06:45 bckinfobckinfo.com systemd[1]: Started The nginx HTTP and reverse proxy server.

Enable Nginx Service

To ensure Nginx starts automatically upon system boot, enable the service by submitting command line :

$ sudo systemctl enable nginx

Output :

ramansah@bckinfobckinfo:~> sudo systemctl enable nginx 
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.

Testing Nginx On OpenSUSE

At this stage, we will test Nginx as web server on OpenSUSE by creating a sample index.html file which is located in /srv/www/htdocs directory. We will usi a vi text editor, as shown below :

$ sudo vi /srv/www/htdocs/index.html$ 
ramansah@bckinfobckinfo:~> sudo vi /srv/www/htdocs/index.html
<html>
<head>
<title>OpenSUSE Tumbleweed - Nginx Server bckinfo.com</title>
</head>
<body>
<h1>Welcome to bckinfo Nginx</h1>
<p>This is a test page as Nginx installation on OpenSuse Tumbleweed.</p>
<hr>
<small>Powered by nginx and OpenSUSE Tumbleweed</small>
</body>
</html>

Then we will test it by using web browser as shown below :

Nginx webserver on OpenSUSE Tumbleweed

Here is the wat to start, stop, restart the Nginx server service on OpenSUSE :

$ sudo systemctl start nginx ## starting Nginx service ##
$ sudo systemctl restart nginx ## restart Nginx service ##
$ sudo systemctl stop nginx ## stop Nginx service ##
$ sudo systemctl status nginx ## Display Nginx status ##

Conclusion

NGINX is not just a web server; it’s a cornerstone of modern web infrastructure, empowering websites to achieve blazing-fast performance, exceptional scalability, and ironclad security. By leveraging NGINX’s advanced features, webmasters and developers can enhance their websites’ SEO rankings, attract more visitors, and ultimately drive business success in the digital age. NGINX is a must-have tool in our arsenal for dominating the online landscape.

(Visited 39 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *