Default Linux, Nginx, MariaDB, PHP7.0 & Adminer stack on Raspbian Jessie.
By default Raspbian Jessie comes with PHP5.6, so you have to add a new repo to use php7. You can use php5.6 but php7 performs far better.
sudo nano /etc/apt/sources.list
deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi
Save the file by pressing Ctrl+x, y, Enter.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
sudo systemctl enable nginx
sudo systemctl start nginx
systemctl status nginx
Now in your browser’s address bar, type http://localhost
or http://127.0.0.1
and hit enter
You will see "Welcome to nginx!, that means nginx installed and running successfully.
Now, we need to make www-data (Nginx user) as the owner of web root directory
sudo chown www-data /var/www/html -R
sudo apt-get install mariadb-server mariadb-client
MariaDB will ask you to set root user's password, provide it and confirm it.
sudo systemctl enable mysql
sudo apt-get install php7.0-fpm php7.0-mbstring php7.0-mysql php7.0-common php7.0-gd php7.0-cli php7.0-curl php7.0-intl php7.0-bcmath php7.0-mcrypt
sudo systemctl start php7.0-fpm
systemctl status php7.0-fpm
sudo rm /etc/nginx/sites-enabled/default
sudo nano /etc/nginx/conf.d/default.conf
server {
server_name localhost;
root /var/www/html/;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php;
}
location /opensourcepos {
try_files $uri $uri/ /opensourcepos/public/index.php;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
expires 15d;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}
sudo nginx -t
sudo service nginx restart
php --version
Test PHP-FPM, create a php_info.php file in the Web root directory
sudo nano /var/www/html/php_info.php
Paste the following code to the file:
<?php phpinfo(); ?>
Now in the browser address bar, enter localhost/php_info.php
. You should see your server’s PHP information. This means PHP is workinging fine. For your server’s security, you should delete php_info.php
file now.
Download Adminer from this page:
Place it in var/www/html folder. To access it, type in your browser localhost/adminer-x.x.x.php
NOTE: x.x.x stands for Adminer version, you have downloaded.
Now download, extract and place opensourcepos
to var/www/html.
Don't forget to rename it as opensourcepos.
Create a new Database using Adminer.
Rename your Application/config/database.php.tmpl to database.php.
Provide database connection credentials by editing the database.php file.
Type in your browser http://localhost/opensourcepos/public
.
ENJOY!
If you have any issue, please post in the Issues section.