Install LEMP (Nginx + MariaDB + PHP) on openSUSE 13.2
Nginx is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption. This tutorial shows you how to install Nginx on a openSUSE 13.2 with PHP support (through PHP-FPM) and MariaDB support. PHP-FPM is an alternative PHP FastCGI implementation, it has some additional features useful for sites of any size, especially busier sites).
The first thing you need to do is to login as root, switch to root user.
$ su
Installing MariaDB:
First we will install the MySQL by issuing the following command.
# zypper install mariadb mariadb-client
Start MySQL server.
# systemctl start mysql.service
To make the MySQL to start during the every boot, Type the following on terminal and hit Enter.
# systemctl enable mariadb.service
Next is to make the MariaDB secure by using the mysql_secure_installation command.
Installing Nginx:
Add Nginx repository using the following command.
# zypper ar -r http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/server:http.repo nginx
Refresh zypper repository, you will be asked to trust a repository; type “a” and then press enter.
# zypper ref
Install Nginx using the following command.
# zypper install nginx
Start the Nginx after the installation.
# systemctl status nginx.service
Open web browser and visit
You should see the following page “403 Forbidden” ; this will confirm you that the ngnix is successfully installed on the server.

The default document root of Nginx is /srv/www/htdocs/, configuration files are under /etc/nginx directory.
Auto start Nginx at system start-up.
# systemctl enable nginx.service
Installing PHP5-FPM:
Next is to install PHP through PHP-FPM (PHP-FPM (FastCGI Process Manager), it is an alternative PHP FastCGI implementation. it has some additional features useful for sites of any size, especially busier sites). Install it by issuing the following command.
# zypper install php5-fpm php5-mysql php5
By default there is no php.ini file in openSUSE 13.2; you would require to copy from /etc/php5/cli/php.ini.
# cp /etc/php5/cli/php.ini /etc/php5/fpm/
Edit /etc/php5/fpm/php.ini.
# vi /etc/php5/fpm/php.ini
set cgi.fix_pathinfo=0
cgi.fix_pathinfo=0
Rename /etc/php5/fpm/php-fpm.conf.default to /etc/php5/fpm/php-fpm.conf
# mv /etc/php5/fpm/php-fpm.conf.default /etc/php5/fpm/php-fpm.conf
Edit php-fpm.conf.
# vi /etc/php5/fpm/php-fpm.conf
Change the log location.
error_log = /var/log/php-fpm.log
In the same file, change owner and group from nobody to nginx.
user = nginx group = nginx
Enabling PHP-FPM:
Edit /etc/nginx/nginx.conf.
# vi /etc/nginx/conf.d/virtual.conf
Un comment the following lines and change “/scripts” to “$document_root“.
FROM
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root /srv/www/htdocs/; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #}
TO
location ~ \.php$ { root /srv/www/htdocs/; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
Testing PHP-FPM support:
For testing the PHP, place one PHP file on to the document root. In the terminal copy/paste the following line:
# vi /srv/www/htdocs/info.php
This will open up a file called info.php, Copy/Paste this line into the info.php file:
<?php phpinfo(); ?>
Restart the services.
# systemctl restart nginx.service # systemctl restart php-fpm.service
Now open up your web browser and type
the page will look like below:

From the above screen shot , PHP is working, and it’s working through FPM/FastCGI, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP. Scroll down further and look for the MySQL support information.

That’s all!