{"id":14992,"date":"2022-02-07T11:07:46","date_gmt":"2022-02-07T11:07:46","guid":{"rendered":"https:\/\/linuxways.net\/?p=14992"},"modified":"2022-02-07T11:07:46","modified_gmt":"2022-02-07T11:07:46","slug":"how-to-install-nginx-on-opensuse","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/opensuse\/how-to-install-nginx-on-opensuse\/","title":{"rendered":"How to Install NGINX on openSUSE"},"content":{"rendered":"<p>Nginx is one of the top open-source <a href=\"https:\/\/linuxways.net\/de\/centos\/top-5-open-source-web-servers-for-linux\/\">web server<\/a> and an HTTP <a href=\"https:\/\/linuxways.net\/de\/centos\/top-5-open-source-load-balancers-2021\/\">load balancer<\/a>. It is also used as a reverse proxy server and an HTTP cache. Nginx has gained popularity since its release because of its efficient resource utilization and responsiveness under load. It is faster at delivering static content while consuming fewer resources.<\/p>\n<p>This post describes how to install Nginx on <strong>openSUSE Leap 15.3<\/strong> system using two different methods.<\/p>\n<p><strong>Note<\/strong>: To install Nginx, you will require <a href=\"https:\/\/linuxways.net\/de\/ubuntu\/how-to-add-a-user-to-sudoers-on-ubuntu\/\">sudo<\/a> privileges. Also, make sure that no <a href=\"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-apache-web-server-on-linux\/\">Apache<\/a> or other process is listening on ports 80 or 443.<\/p>\n<h2>Method#1<\/h2>\n<p>In this method, we will install Nginx available in the openSUSE default repositories. This is the easiest method, however, this package is an older version.<\/p>\n<p>1. Run the command below to refresh your system repositories:<\/p>\n<pre>$ sudo zypper refresh<\/pre>\n<p>If prompted, enter the sudo password.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"918\" height=\"253\" class=\"wp-image-14993\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-241.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-241.png 918w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-241-300x83.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-241-768x212.png 768w\" sizes=\"auto, (max-width: 918px) 100vw, 918px\" \/><\/p>\n<p>2. Then run the command below to install Nginx on your openSUSE system:<\/p>\n<pre>$ sudo zypper install nginx<\/pre>\n<p>Then you&#8217;ll be given details about installation, such as the packages that will be installed on your openSUSE system, their overall download size, and the disk space that will be used. After providing the details, you\u2019ll be asked to confirm if you wish to carry on the procedure. Hit <strong>y<\/strong> and then the <strong>Return<\/strong> key to carry on.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"926\" height=\"607\" class=\"wp-image-14994\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-242.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-242.png 926w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-242-300x197.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-242-768x503.png 768w\" sizes=\"auto, (max-width: 926px) 100vw, 926px\" \/><\/p>\n<p>Now Nginx will be installed on your openSUSE system.<\/p>\n<p>3. Run the command below to enable the Nginx service:<\/p>\n<pre>$ sudo systemctl enable nginx<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1027\" height=\"102\" class=\"wp-image-14995\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-243.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-243.png 1027w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-243-300x30.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-243-1024x102.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-243-768x76.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-243-1020x102.png 1020w\" sizes=\"auto, (max-width: 1027px) 100vw, 1027px\" \/><\/p>\n<p>Then start the Nginx service through the command below:<\/p>\n<pre>$ sudo systemctl start nginx<\/pre>\n<p>To verify the status of Nginx, run the command below:<\/p>\n<pre>$ sudo systemctl status nginx<\/pre>\n<p>The output below indicates that the Nginx service is running.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1019\" height=\"154\" class=\"wp-image-14996\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-244.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-244.png 1019w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-244-300x45.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-244-768x116.png 768w\" sizes=\"auto, (max-width: 1019px) 100vw, 1019px\" \/><\/p>\n<p>To view the version of the Nginx package installed on your openSUSE system, run the command below:<\/p>\n<pre>$ sudo nginx -v<\/pre>\n<p>The output below indicates Nginx version <strong>1.19.8<\/strong> is installed on our system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"472\" height=\"73\" class=\"wp-image-14997\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-245.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-245.png 472w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-245-300x46.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/p>\n<h2>Method#2<\/h2>\n<p>In this method, we will install Nginx by adding the repository available at the openSUSE website. Through this method, you can have an updated version of Nginx on your system.<\/p>\n<p>1. To install the newest version of Nginx on your openSUSE, add the repository using the command below:<\/p>\n<pre>$ sudo zypper addrepo <a href=\"https:\/\/download.opensuse.org\/repositories\/server:http\/openSUSE_Leap_15.3\/server:http.repo\">https:\/\/download.opensuse.org\/repositories\/server:http\/openSUSE_Leap_15.3\/server:http.repo<\/a><\/pre>\n<p>If prompted, enter sudo password.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1004\" height=\"325\" class=\"wp-image-14998\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-246.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-246.png 1004w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-246-300x97.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-246-768x249.png 768w\" sizes=\"auto, (max-width: 1004px) 100vw, 1004px\" \/><\/p>\n<p>2. After adding the repository, run the below command to refresh the local repository index:<\/p>\n<pre>$ sudo zypper refresh<\/pre>\n<p>This command will prompt you to accept or reject the GPG key for the repository you have added. Type <strong>a<\/strong> and hit <strong>Enter<\/strong> to accept the GPG key.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1106\" height=\"565\" class=\"wp-image-14999\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-247.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-247.png 1106w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-247-300x153.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-247-1024x523.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-247-768x392.png 768w\" sizes=\"auto, (max-width: 1106px) 100vw, 1106px\" \/><\/p>\n<p>3. Now you can install Nginx latest version through the command below:<\/p>\n<pre>$ sudo zypper install nginx<\/pre>\n<p>Then you&#8217;ll be given information about Nginx installation, such as the packages that will be installed on your openSUSE system, their overall download size, and the disk space that will be used. After giving the information, you will be asked to confirm if you wish to carry on the procedure. Hit <strong>y<\/strong> and then the <strong>Return<\/strong> key to carry on.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"944\" height=\"528\" class=\"wp-image-15000\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-248.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-248.png 944w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-248-300x168.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-248-768x430.png 768w\" sizes=\"auto, (max-width: 944px) 100vw, 944px\" \/><\/p>\n<p>Now Nginx will be installed on your openSUSE system.<\/p>\n<p>4. Run the command below to enable the Nginx service:<\/p>\n<pre>$ sudo systemctl enable nginx<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1027\" height=\"102\" class=\"wp-image-15001\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-249.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-249.png 1027w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-249-300x30.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-249-1024x102.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-249-768x76.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-249-1020x102.png 1020w\" sizes=\"auto, (max-width: 1027px) 100vw, 1027px\" \/><\/p>\n<p>Then start the Nginx service through the command below:<\/p>\n<pre>$ sudo systemctl start nginx<\/pre>\n<p>To verify the status of Nginx, run the command below:<\/p>\n<pre>$ sudo systemctl status nginx<\/pre>\n<p>The output below indicates that the Nginx service is running.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1019\" height=\"154\" class=\"wp-image-15002\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-250.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-250.png 1019w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-250-300x45.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-250-768x116.png 768w\" sizes=\"auto, (max-width: 1019px) 100vw, 1019px\" \/><\/p>\n<p>To view the version of the Nginx package installed on your openSUSE system, run the command below:<\/p>\n<pre>$ sudo nginx -v<\/pre>\n<p>The output below indicates Nginx version <strong>1.21.6<\/strong> is installed on our system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"479\" height=\"58\" class=\"wp-image-15003\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-251.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-251.png 479w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-251-300x36.png 300w\" sizes=\"auto, (max-width: 479px) 100vw, 479px\" \/><\/p>\n<h2>Firewall Configuration<\/h2>\n<p>You will also need to configure the firewall to open the http and https ports used by Nginx.<\/p>\n<p>To find the default zone in your firewall, run the command below:<\/p>\n<pre>$ sudo firewall-cmd --get-default-zone<\/pre>\n<p>In the output, you can find out your firewall\u2019s default zone.<\/p>\n<p>Then use the command below to open <strong>http<\/strong> port in your firewall:<\/p>\n<pre>$ sudo firewall-cmd --permanent --zone=public --add-service=http<\/pre>\n<p>Use the command below to open <strong>https<\/strong> port in your firewall:<\/p>\n<pre>$ sudo firewall-cmd --permanent --zone=public --add-service=https<\/pre>\n<p>You can replace &#8220;public&#8221; zone with the zone that is currently set as your default zone.<\/p>\n<p>Then to apply the changes, run the command below:<\/p>\n<pre>$ sudo firewall-cmd --reload<\/pre>\n<h2>Test<\/h2>\n<p>Now to test Nginx server, create an <strong>index.html<\/strong> file in the <strong>\/srv\/www\/htdocs<\/strong> folder.<\/p>\n<pre>$ sudo nano \/srv\/www\/htdocs\/index.html<\/pre>\n<p>Add below lines in the <strong>index.html<\/strong> file:<\/p>\n<pre>html&gt;\r\n\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;......Welcome to NGINX!......&lt;\/h1&gt;\r\n\r\n&lt;\/body&gt;\r\n\r\n&lt;\/html&gt;<\/pre>\n<p>Save and close the <strong>index.html<\/strong> file.<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"524\" height=\"196\" class=\"wp-image-15004\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-252.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-252.png 524w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-252-300x112.png 300w\" sizes=\"auto, (max-width: 524px) 100vw, 524px\" \/><\/p>\n<p>Restart the Nginx service through the command below:<\/p>\n<pre>$ sudo systemctl restart nginx<\/pre>\n<p>Now launch any web browser on your system and type localhost or your <a href=\"https:\/\/linuxways.net\/de\/centos\/6-ways-to-find-your-private-ip-address-in-centos-8\/\">IP address<\/a> in the address bar. If Nginx is installed correctly, you will see the following page.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"273\" class=\"wp-image-15005\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-253.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-253.png 744w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-253-300x110.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/p>\n<h2>Uninstalling Nginx on openSUSE<\/h2>\n<p>If you ever need to uninstall Nginx, you can do so using the command below:<\/p>\n<pre>$ sudo zypper remove nginx<\/pre>\n<p>If prompted, enter the sudo password. Then it will mention you the packages that will be uninstalled from your openSUSE system and the disk space that will be freed. Then you\u2019ll be asked to confirm if you wish to carry on the procedure. Hit <strong>y<\/strong> and then the <strong>Return<\/strong> key to remove Nginx from your openSUSE system.<\/p>\n<p>Through any of the methods shared in this post, you can easily install Nginx on your openSUSE system. The method to uninstall Nginx is also described at the end of this post if you ever need to remove it. Visit how to install Nginx on <a href=\"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-nginx-on-ubuntu-20-04\/\">Ubuntu<\/a> and <a href=\"https:\/\/linuxways.net\/de\/centos\/how-to-install-nginx-on-centos\/\">CentOS<\/a>, if you are running these Linux distributions.<\/p>","protected":false},"excerpt":{"rendered":"<p>Nginx is one of the top open-source web server and an HTTP load balancer. It is also used as a reverse proxy server and an HTTP cache. Nginx&hellip;<\/p>","protected":false},"author":1,"featured_media":15070,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[83],"tags":[149,858],"class_list":["post-14992","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-opensuse","tag-nginx","tag-opensuse"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=14992"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14992\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/15070"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=14992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=14992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=14992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}