How To Install Nginx on SUSE Linux Enterprise server 12

Originally published at:

How do I install and setup Nginx server on SuSe Enterprise Linux server (SLES) version 12 SP 3?

Can I use all commands on OpenSUSE? I do not have SUSE to play with.

nginx is in OpenSUSE repo. No need to configure repo. All you have to do is:

sudo zypper install nginx

Please note that config file is located at:

vi /etc/nginx/nginx.conf

The default document root is at /srv/www/htdocs/

cd /srv/www/htdocs/

You need to upload/copy your html/css/js/image in /srv/www/htdocs/ directory. For example:

echo 'This is a test page on OpenSUSE running nginx' > /srv/www/htdocs/index.html

Most of the steps are same line:

systemctl status nginx
systemctl stop nginx
systemctl start nginx
systemctl restart nginx