Linux Tutorials

How one can set up and use Nginx on OpenSUSE Linux server

How do I set up and configure the most recent model of Nginx net server on OpenSUSE Linux server utilizing the CLI and host a static website?

Introduction – Nginx [engine x] is free and open supply high-performance net server. It additionally acts as a reverse proxy server, in addition to. This web page exhibits easy methods to set up Nginx server on OpenSUSE Linux and configure a static site.

How one can set up Nginx on OpenSUSE Linux

The process to put in Nginx weber server on an RHEL 7 or CentOS Linux 7 is as follows:

Login to your cloud server or naked steel server utilizing ssh command:
ssh person@cloud-server-ipSeek for nginx bundle identify utilizing zypper or cnf:
cnf nginxSet up nginx bundle utilizing the zypper command on OpenSUSE:
sudo zypper replace
sudo zypper set up nginx

Allow us to see all steps, instructions and configuration in particulars for OpenSUSE Linux.

Seek for nginx bundle

Discover if nginx net server accessible on OpenSUSE by working the next cnf command and zypper command:
$ sudo zypper set up nginx
Command to Install and use Nginx on OpenSUSE Linux serverPutting in nginx utilizing zypper command

How one can begin, cease, restart the Nginx server on OpenSUSE

Use the systemctl command:
$ sudo systemctl begin nginx ## <-- begin the service ##
$ sudo systemctl restart nginx ## <-- restart the service ##
$ sudo systemctl cease nginx ## <-- cease the service ##
$ sudo systemctl standing nginx ## <-- Get the standing of the service ##

How one can allow the Nginx service at boot time on OpenSUSE

Once more run the next systemctl command:
$ sudo systemctl allow nginx.service
How to start, stop, restart the Nginx on OpenSUSE Linux server
Confirm that nginx is working utilizing the ss command and TCP port 80 is open:
$ sudo ss -tulpn | grep nginx

tcp LISTEN zero 128 zero.zero.zero.zero:80 zero.zero.zero.zero:* customers:((“nginx”,pid=20511,fd=6),(“nginx”,pid=20510,fd=6))

Configuring nginx on OpenSUSE server

Allow us to create a pattern index.html file in /srv/www/htdocs utilizing a textual content editor similar to vim command:
$ sudo vi /srv/www/htdocs/index.html
Append the next html:

<html>
<head>
<title>OpenSUSE Linux – Nginx Server by NixCraft</title>
</head>
<physique>
<h1>Welcome</h1>
<p>This can be a check server for static information.</p>
<hr>
<small>Powered by nginx and OpenSUSE Linux server</small>
</physique>
</html>

Welcome

This can be a check server for static information.


Powered by nginx and OpenSUSE Linux server

Save and shut the file in vim textual content editor. Use the ip command and grep command to seek out out your server IP handle
$ 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 international eth0

Hearth an online browser and sort url:
http://server-ip/
http://192.168.2.133/
Testing Nginx on OpenSUSE Linux

Configure Nginx server

Essential information and listing to configure Nginx on OpenSUSE Linux:

Config dir – /and so on/nginx/Grasp/World config file – /and so on/nginx/nginx.confDefault TCP ports opened by Nginx – 80 (HTTP), 443 (HTTPS)Doc root listing – /srv/www/htdocs/Digital host area config dir – /and so on/nginx/vhosts.d/

To edit information use a textual content editor similar to vi:
$ sudo vi /and so on/nginx/nginx.conf
You’ll be able to add or copy your html/css/js and pictures 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 native desktop to the distant server utilizing the rsync command or sftp command:
$ rsync -avP ~/initiatives/static/your-domain/* root@192.168.2.133:/srv/www/htdocs/

Conclusion

Within the subsequent a part of the collection, you’ll discover ways to set up the most recent model of PHP 7.x.x on OpenSUSE Linux server and safe communication with TLS/SSL certificates. For more information on nginx config see this web page right here.

Posted by: Vivek Gite

The creator is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a coach for the Linux working system/Unix shell scripting. Get the newest tutorials on SysAdmin, Linux/Unix and open supply matters through RSS/XML feed or weekly electronic mail publication.

Source link

Related Articles

Back to top button