OSETC TECH

How to Install Nginx on OpenSUSE Linux

This post will guide you how to install Nginx web server on OpenSUSE Linux. How do I install Nginx, PHP and MySQL Web server on your OpenSUSE Linux.

What is Ngiunx?


NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.

Install Nginx on OpenSUSE Linux


To Install Nginx on OpenSUSE Linux, you just need to do the following steps:

#1 install and configure SUSEfirewall2

You need to install SuSefirewall2 package to configure firewall policy with zipper command. Type the following command:

# zipper install SuSefirewall2

Then you need to update the configuration file of SuSefirewall2, it is located in /etc/sysconfig/SuSefirewall2, edit it with vim editor, type:

# vim /etc/sysconfig/SuSefirewall2

Find one variable called “FW_SERVICES_EXT_TCP” and change it as below:

FW_SERVICES_EXT_TCP="22 80 443"

Save and close the file. Then restart SuSEfirewall2 service. Type the following command:

# /sbin/rcSuSEfirewall2 restart

# systemctl restart sshd.service

#2 install and Configure Nginx

You can use the zipper tool to install nginx package and it’s dependency packages. Type:

#zypper install nginx

#3 enable the Nginx service

You need to enable the nginx service so that it can be started at boot time. Type:

# systemctl enable nginx

#4 start the Nginx service

Type the following command:

# systemctl  start nginx

Now you can create one index.html file in the root web directory located in “/src/www/htdocs”. Then try to access the web service with web browser, then type the link address: http://127.0.0.1

Install MariaDB on OpenSUSE Linux


You can also use the zipper command to install the stable MariaDB, type:

# zipper install mariadb mariadb-client

Then enable and start mariadb service, type the following command:

# systemctl enable mariadb

# systemctl start mariadb

Install PHP-FRM on OpenSUSE Linux


If you need to install php5-fpm, just type the following command:

# zipper install php5 php5-mysql php5-fpm php5-gd php5-mbstring

Then you need to update the configuration file of php5-fpm located in /etc/php5/fpm/php-fpm.conf, changing some variables like as the below lines:

error_log = log/php-fpm.log

user = nginx

group = nginx

listen = /var/run/php-fpm.sock

listen.owner = nginx

listen.group = nginx

listen.mode = 0660

cgi.fix_pathinfo=0

Save and close the file.

Start php-fpm service and restart the nginx service, type:

# systemctl start php-fpm

# systemctl restart nginx