Pocketbase Hosting on Apache or XAMPP
Wall Script
Wall Script
Sunday, October 30, 2022

Pocketbase Hosting on Apache or XAMPP

Pocketbase is an open-source application and alternative to Google Firebase. This is offering realtime database, authentication(including social), and file storage for your next web and mobile application. This article is about how to host the Pocketbase application server which usually runs at 8090 port with your existing application server. If you are using Linux and Apache based server, the following steps will help you to virtual host different ports host to the default 80 port.

Pocketbase Hosting on Apache or XAMPP

Live Demo

Download Pocketbase
Create a Pocketbase directory and use wget command  to download the Pocketbase application. Unzip the downloaded zip file. You will more details and download options in Pocketbase documentation.
$mkdir pocketbase
$cd pocketbase
$wget https://github.com/pocketbase/pocketbase/releases/download/v0.7.9/pocketbase_0.7.9_linux_amd64.zip

$sudo apt-get install unzip
$unzip pocketbase_0.7.9_linux_amd6.zip

Start Pocketbase Server
Use the following command to run the pocketbase server. Pocketbase server runs at port 8090.
$./pocketbase serve - if pb_public directory exists, serves the static content from it (html, css, images, etc.) - Admin dashboard UI - REST API

Create Start Server Bash Shell Script File(start.sh)
Same directory create a bash shell script file to execute the pocketbase server. Here /home/ubuntu/pocketbase/ is the downloaded location.

cd /home/ubuntu/pocketbase

./pocketbase serve

Pocketbase Login
Signup and create your admin password.
Pocketbase Hosting on Apache or XAMPP

Pocketbase Dashboard
Pocketbase Hosting on Apache or XAMPP

Create Pocketbase Service for System Startup
Go to /etc/systemd/system directory and create pocketbase.service file.
cd /etc/systemd/system
vi pocketbase.service

Here you have to configure your start.sh file. If you have a different location, just update the ExecStart path.









Verify Service Status
 $systemctl status pocketbase.service

pocketbase.service - Pocketbase

     Loaded: loaded (/etc/systemd/system/pocketbase.service; enabled; vendor preset: enab>

     Active: inactive (dead) 

Enable Pocketbase Service
The following command enables the pocketbase.service for the startup.
$systemctl enable pocketbase.service
Created symlink /etc/systemd/system/multi-user.target.wants/pocketbase.service → /etc/systemd/system/pocketbase.service

Active Status
Now you will find the status is active.
systemctl status pocketbase.service

pocketbase.service - Pocketbase

     Loaded: loaded (/etc/systemd/system/pocketbase.service; enabled; vendor preset: enab>

     Active: active (running) since Mon 2022-10-17 02:35:41 UTC; 1 weeks 0 days ago

   Main PID: 865 (start.sh)

      Tasks: 8 (limit: 1121)

     Memory: 16.7M

     CGroup: /system.slice/pocketbase.service

             ├─865 /bin/bash /home/ubuntu/pocketbase/start.sh

             └─873 ./pocketbase serve

Oct 17 02:35:41 ip-972-62-1-235 systemd[1]: Started Pocketbase.

Oct 17 02:35:41 ip-972-62-1-235 start.sh[873]: > Server started at:

Oct 17 02:35:41 ip-972-62-1-235 start.sh[873]:   - REST API:

Oct 17 02:35:41 ip-972-62-1-235 start.sh[873]:   - Admin UI:

Restart Server
Restart your server and check the service status again.
$sudo reboot

Domain DNS
You have to configure your domain A IP.
Pocketbase Hosting

You have to proxy 8090 port with default port 80.

Enable Apache modules
You have to enable the following apache modules for proxy forwarding.
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod headers

Backup Original Configuration
$cd /etc/apache2/sites-available/
$cp 000-default.conf 000-default-back.conf

Edit Default Configuration
$vi /etc/apache2/sites-available/000-default.conf

Include the following virtual host configuration
<VirtualHost *:80>

 ProxyPreserveHost On

 ProxyRequests Off

 ServerName www.sub.domain.com

 ServerAlias sub.domain.com

 ProxyPass / http://localhost:8090/

 ProxyPassReverse / http://localhost:8090/


Restart Apache Server
Apache restart will reflect the changes.
$sudo /etc/init.d/apache2 restart

You have to follow different steps for XAMPP server.

Configure Virtual Hosts
Go to the following path and modify httpd-vhosts.conf file. Better take a backup before modifying.
$vi /opt/lampp/etc/extra/httpd-vhosts.conf

Include both configurations.
<VirtualHost *:80>

    DocumentRoot "/opt/lampp/htdocs"

    ServerName localhost


<VirtualHost *:80>

      ServerName sub.domain.com

      ServerAlias sub.domain.com

      <Location />

    ProxyPass http://localhost:8090/

    ProxyPassReverse http://localhost:8090/



XAMPP Configuration
$vi /opt/lampp/etc/httpd.conf

Enable httpd vhosts Scroll down and enable support for vhosts.
# Virtual hosts
Include etc/extra/httpd-vhosts.conf

Restart XAMPP XAMPP restart will reflect the server changes.
$sudo /otp/lampp/lampp restart
web notification


mailxengine Youtueb channel
Make in India