This guide details the process of installing OSPoS—an open-source point-of-sale system, on a server running Nginx. The instructions assume you have a LEMP stack (Linux, Nginx, MySQL, PHP-FPM) in place, along with the necessary PHP extensions.
Prerequisites.
Before starting, ensure that your server has:
Server Environment:
- Ubuntu (or another Linux distribution) with Nginx, PHP-FPM, and MySQL installed.
- For a smoother setup, consider learning how to install Ubuntu and using control panels like aapanel.
PHP Extensions:
php-gd
php-bcmath
php-intl
php-openssl
php-mbstring
php-curl
php-xml
Make sure these extensions are installed and enabled.
Step 1: Download OSPoS
Download the OSPoS codebase from GitHub. You can either clone the repository or download the files directly:
Clone the Repository:
git clone https://github.com/opensourcepos/opensourcepos.git
Alternative Download:
You can also download the compressed files from GitHub and then upload them to your server.
Step 2: Configure the Database
OSPoS requires a MySQL database for data storage:
Create a Database:
Log into your MySQL server and create a new database along with a dedicated user having the appropriate permissions.Update the Configuration File:
Open the fileapplication/config/database.php
in the OSPoS folder and update it with your new database credentials.Import the Database:
Locate the database file in thedatabase
folder within the OSPoS package and import it into your newly created database.Step 3: Configure Nginx
To serve OSPoS through Nginx, set up a new server block that points to the public folder of the OSPoS installation.
Create a Server Block:
Create a new configuration file (e.g., in/etc/nginx/sites-available/
) and define your server block.Set the Root Directory:
Configure theroot
directive to point to thepublic
folder inside your OSPoS installation.Configure PHP-FPM:
Set up Nginx to process PHP files through PHP-FPM.Handle URL Rewriting:
Enable clean URLs using rewrite rules.
Here’s an example configuration:
server { listen 80; server_name your_domain.com;
root /path/to/opensourcepos/public;
index index.php index.html index.htm;
location / { rewrite ^/(.*)$ /public/$1 permanent; }
`location / { try_files $uri $uri/ /public/index.php?$args; }
location ~ .php$ { fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;
}
}
Important:
- Replace
your_domain.com
with your actual domain name. - Adjust the
root
path and thefastcgi_pass
socket path to match your server’s configuration.
Step 4: Restart Nginx and PHP-FPM
Apply your configuration changes by restarting both services:
sudo systemctl restart nginxsudo systemctl restart php7.4-fpm
Final Thoughts
Once completed, your OSPoS installation should be accessible via your configured domain. This setup ensures that your point-of-sale system operates on a robust and secure LEMP environment. Always remember to maintain your server by applying updates and securing your services.
Happy deploying!
you can watch a video here