0% found this document useful (0 votes)
380 views

How To Install and Use Nginx On OpenSUSE Linux Server - Nixcraft

This document provides instructions on how to install and configure the Nginx web server on OpenSUSE Linux. It details how to search for the Nginx package, install Nginx, configure the service, set up a static website, open required ports in the firewall, and install additional Nginx modules.

Uploaded by

Matele
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
380 views

How To Install and Use Nginx On OpenSUSE Linux Server - Nixcraft

This document provides instructions on how to install and configure the Nginx web server on OpenSUSE Linux. It details how to search for the Nginx package, install Nginx, configure the service, set up a static website, open required ports in the firewall, and install additional Nginx modules.

Uploaded by

Matele
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

nixCraft


Howto

Linux

How to install and use Nginx on OpenSUSE Linux server

How to install and use Nginx on


OpenSUSE Linux server
Author: Vivek Gite
Last updated: July 15, 2020
0 comments

H ow do I install and configure the latest version of Nginx web server


on OpenSUSE Linux server using the CLI and host a static site?

Introduction – Nginx [engine x] is free and open source high-performance


web server. It also acts as a reverse proxy server, as well as. This page
shows how to install Nginx server on OpenSUSE Linux and configure a static web site.

Tutorial requirements

Requirements OpenSUSE Linux

Root privileges Yes

Difficulty level Easy

Est. reading time 5 minutes


Tutorial requirements

Table of contents ↓

1 Search for nginx package


2 Installing nginx

3 Start/Stop/Restart Nginx service


4 Configuring nginx
5 Firewall configuration to open TCP 80/443 ports

6 Install additional nginx modules


7 Conclusion


e l g o oG
ADVERTISEMENT

Google Play Console

Google Play Console


l g o oG
Learn More

How to install Nginx on OpenSUSE Linux


The procedure to install Nginx weber server on an OpenSUSE Linux version 15.1/15.2
or Tumbleweed is as follows:

1. Login to your cloud server or bare metal server using ssh command:

ssh user@cloud-server-ip
2. Search for nginx package name using zypper or cnf:

cnf nginx

OR
zypper search nginx

3. Install nginx package using the zypper command on OpenSUSE:

sudo zypper update

sudo zypper install nginx

Let us see all steps, commands and configuration in details for OpenSUSE Linux.

Search for nginx package


Find if nginx web server available on OpenSUSE by running the following cnf command
and zypper command:

$ cnf nginx

$ zypper info nginx


Find information about the nginx:

$ sudo zypper info nginx

Loading repository data...

Reading installed packages...

Information for package nginx:

------------------------------

Repository : Main Update Repository

Name : nginx

Version : 1.16.1-lp151.4.11.1

Arch : x86_64

Vendor : openSUSE

Installed Size : 2.6 MiB

Installed : No

Status : not installed

Source package : nginx-1.16.1-lp151.4.11.1.src

Summary : A HTTP server and IMAP/POP3 proxy server

Description :

nginx [engine x] is a HTTP server and IMAP/POP3 proxy server written by Ig


It has been running on many heavily loaded Russian sites for more than two

Installing nginx on OpenSUSE Linux


To install Nginx version 1.14.0 (latest stable in OpenSUSE), run the following zypper
command:

$ sudo zypper install nginx


Installing nginx using zypper command

How to start, stop, restart the Nginx server on OpenSUSE


Use the systemctl command:

$ sudo systemctl start nginx ## <-- start the service ##

$ sudo systemctl restart nginx ## <-- restart the service ##

$ sudo systemctl stop nginx ## <-- stop the service ##

$ sudo systemctl status nginx ## <-- Get the status of the service ##
Global Trade Starts Here
Alibaba.com

How to enable the Nginx service at boot time on OpenSUSE


Again run the following systemctl command:

$ sudo systemctl enable nginx.service

Start it:

$ sudo systemctl start nginx.service


Verify that nginx is running using the ss command and TCP port 80 is open:

$ sudo ss -tulpn | grep nginx

Global Trade Starts Here


Alibaba.com

tcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("nginx",p

Configuring nginx on OpenSUSE server


Let us create a sample index.html file in /srv/www/htdocs using a text editor such as vim
command:

$ sudo vi /srv/www/htdocs/index.html

Append the following html:

<html>

<head>

<title>OpenSUSE Linux - Nginx Server by NixCraft</title>


</head>

<body>

<h1>Welcome</h1>

<p>This is a test server for static files.</p>

<hr>

<small>Powered by nginx and OpenSUSE Linux server</small>

</body>

</html>

Global Trade Starts Here


Alibaba.com

Save and close the file in vim text editor. Use the ip command and grep command to
find out your server IP address

$ ip a s

$ ip a s eth0

$ ip a s eth0 | grep -w inet

inet 192.168.2.133/24 brd 139.162.28.255 scope global eth0


Fire a web browser and type url:

http://server-ip/

http://192.168.2.133/

Configure Nginx server


Important files and directory to configure Nginx on OpenSUSE Linux:
Config dir – /etc/nginx/

Master/Global config file – /etc/nginx/nginx.conf

Default TCP ports opened by Nginx – 80 (HTTP), 443 (HTTPS)

Document root directory – /srv/www/htdocs/

Virtual host domain config dir – /etc/nginx/vhosts.d/

To edit files use a text editor such as vi:

$ sudo vi /etc/nginx/nginx.conf

You can upload or copy your html/css/js and images to /srv/www/htdocs/:

$ cd /srv/www/htdocs/

$ sudo cp /backups/your-domain/*.html .

$ sudo cp /backups/your-domain/*.css .

$ sudo cp /backups/your-domain/*.png .

OR Copy from local desktop to the remote server using the rsync command or sftp
command:

$ rsync -avP ~/projects/static/your-domain/*


[email protected]:/srv/www/htdocs/

Open TCP port 80 and 443 using firewalld


Run the following command to find your default zone:

sudo firewall-cmd --get-default-zone

Sample outputs:
public

Next, open TCP port 80 (http) for public zone:

sudo firewall-cmd --zone=public --add-service=http --permanent

Run same command but for TCP port 443 (https):

sudo firewall-cmd --zone=public --add-service=https --permanent

Finally, reload the firewall, run:

sudo firewall-cmd --reload

See “How to set up a firewall using FirewallD on OpenSUSE Linux” for more info.

Install additional nginx modules


Use the following command to search additional modules to enhance Nginx server
featues:

$ sudo zypper search nginx

Loading repository data...

Reading installed packages...

S | Name | Summary
---+----------------------------------------+-----------------------------------------------------------
| dehydrated-nginx | Nginx Integration for dehydrated
i | nginx | A HTTP server and IMAP/POP3 proxy server
| nginx | A HTTP server and IMAP/POP3 proxy server
| nginx-geolite-asn | IP ASN geolocation databases for nginx
| nginx-geolite-city | Free IP city geolocation databases for nginx
| nginx-geolite-country | Free IP country geolocation databases for nginx
| nginx-ingress-controller | Kubernetes ingress controller for nginx
i+ | nginx-module-brotli | NGINX module for Brotli compression
| nginx-module-cookie-flag | The Nginx module for adding cookie flag
| nginx-module-devel-kit | Additional generic tools for nginx module development
| nginx-module-devel-kit-source | The nginx-module-devel-kit source
| nginx-module-http-auth-digest | Digest Authentication for Nginx
| nginx-module-http-substitutions-filter | Regular expression and fixed string substitutions nginx fi
| nginx-module-modsecurity | ModSecurity v3 Nginx Connector
| nginx-module-set-misc | Various set_xxx directives added to nginx's rewrite module
| nginx-module-sticky-ng | Nginx module to add a sticky cookie to be forwarded to the
| nginx-module-vts | Nginx virtual host traffic status module
| nginx-source | The nginx source
| pcp-pmda-nginx | Performance Co-Pilot (PCP) metrics for the Nginx Webserver
| python-certbot-nginx | Nginx plugin for Certbot
| python2-certbot-nginx | Nginx plugin for Certbot
| python3-certbot-nginx | Nginx plugin for Certbot
| rubygem-passenger-nginx | Passenger Nginx module
| vim-plugin-nginx | VIM support for nginx config files

For example, one can install ModSecurity module as follows:

$ sudo zypper in nginx-module-modsecurity

Conclusion
In the next part of the series, you will learn how to install the latest version of PHP 7.x.x
on OpenSUSE Linux server and secure communication with TLS/SSL certificates. For
more info on nginx config see this page here.

This entry is 1 of 3 in the OpenSUSE Linux LEMP Stack Tutorial series. Keep reading the rest of
the series:
1. Install and use Nginx on OpenSUSE Linux

2. Secure Nginx with Let's Encrypt on OpenSUSE Linux

3. Install PHP on OpenSUSE Linux 15.2/15.1


About the author:
Vivek Gite is the founder of nixCraft, the oldest running blog about
Linux and open source. He wrote more than 7k+ posts and helped numerous readers
to master IT topics. Join the nixCraft community via RSS Feed or Email Newsletter.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.
nixCraft is a one-person show, and many of you use Adblocker. Keeping the site
online is challenging, with everyone blocking Ads 😔. Please support the nixCraft with
a PayPal donation or Patreon.

🔎 To search, type & hit enter...

Related Tutorials

OpenSUSE install Brotli module for Nginx

How to secure Nginx with Let's Encrypt on OpenSUSE 15.1/15.2

How to install and use Nginx on CentOS 7 / RHEL 7

How to install and use Nginx on CentOS 8

How To Configure Nginx to use TLS 1.2 / 1.3 only

How To Install Nginx web server on Alpine Linux


How To Install Nginx on SUSE Linux Enterprise server 12

Category List of Unix and Linux commands

Ansible Check version • Fedora • FreeBSD • Linux • Ubuntu 18.04 • Ubuntu • macOS

Backup
Debian/Ubuntu • FreeBSD • RHEL
Management

Database Backup MySQL server • MariaDB Galera cluster • MariaDB TLS/SSL • MariaDB replication

Server • MySQL Server • MySQL remote access

Download
wget
managers

Driver
Linux Nvidia driver • lsmod
Management

Documentation help • mandb • man • pinfo

Disk
df • duf • ncdu • pydf
Management

File
cat • cp • less • mkdir • more • tree
Management

Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu
Firewall
20.04 • Ubuntu 24.04

KVM
CentOS/RHEL 7 • CentOS/RHEL 8 • Debian 9/10/11 • Ubuntu 20.04
Virtualization

Linux Desktop
Chrome • Chromium • GIMP • Skype • Spotify • VLC 3
apps

LXD Backups • CentOS/RHEL • Debian 11 • Fedora • Mount dir • Ubuntu 20.04 • Ubuntu 22.04
Category List of Unix and Linux commands

Modern utilities bat • exa

Network
Monitoring tools • Network services • RHEL static IP • Restart network interface • nmcli
Management

Network Utilities NetHogs • dig • host • ip • nmap • ping

OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 11 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04

Power
upower
Management

Package
apk • apt-get • apt • yum
Manager

Processes bg • chroot • cron • disown • fg • glances • gtop • iotop • jobs • killall • kill • pidof • pstree •

Management pwdx • time • vtop

Searching ag • egrep • grep • whereis • which

Shell builtins compgen • echo • printf

System
reboot • shutdown
Management

Terminal/ssh sshpass • tty

Text processing cut • rev

Text Editor 6 Text editors • Save and exit vim

User
exit • who
Environment

User
groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • w
Information

User
/etc/group • /etc/passwd • /etc/shadow • chsh
Management

Web Server Apache • Let's Encrypt certificate • Lighttpd • Nginx Security • Nginx
Category List of Unix and Linux commands

WireGuard VPN Alpine • Amazon Linux • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 • qrencode

0 comments… add one ↓

Leave a Reply

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

Comment *

Name

Post Comment

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site
admin.

Next FAQ: How to set up a firewall using FirewallD on RHEL 8

Previous FAQ: How to install and setup PostgreSQL on RHEL 8







Google Play
Console
See new performance insights
added. Get started today.

Google Play Console

SEARCH

🔎 To search, type & hit enter...

Google Play
Console
See new performance insights
added. Get started today.

Google Play Console

FEATURED ARTICLES
1 30 Cool Open Source Software I Discovered in 2013

2 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X

3 Top 32 Nmap Command Examples For Linux Sys/Network Admins

4 25 PHP Security Best Practices For Linux Sys Admins

5 30 Linux System Monitoring Tools Every SysAdmin Should Know

6 40 Linux Server Hardening Security Tips

7 Linux: 25 Iptables Netfilter Firewall Examples For New SysAdmins

8 Top 20 OpenSSH Server Best Security Practices

9 Top 25 Nginx Web Server Best Security Practices

10 My 10 UNIX Command Line Mistakes


SIGN UP FOR MY NEWSLETTER

➔ Linux shell scripting tutorial

➔ RSS/Feed

➔ About nixCraft







©2002-2023 nixCraft • Privacy • ToS • Contact/Email • Corporate patron Linode &
Cloudflare






You might also like