Lunar on Ubuntu 24.04 on Azure User Guide
Overview
Lunar is a modern, free and open source headless ecommerce package for the Laravel framework. It brings a clean commerce domain model — catalog, products, collections, pricing, orders, customers, tax and shipping — together with an admin panel and an API, so you build a store on a foundation you fully control. This image deploys the official Lunar storefront example (the Lunar Livewire starter kit), pairing a customer facing storefront with the Lunar admin panel for day to day management. The cloudimg image delivers Lunar fully installed and configured on Ubuntu 24.04 — a Laravel application on PHP 8.3 with OPcache, served by nginx over HTTPS with php-fpm, backed by MariaDB. Migrations, the demo catalog and the compiled storefront assets are already in place, so you land directly on a working storefront and admin sign-in with no setup wizard to complete. Backed by 24/7 cloudimg support.
What is included:
- Lunar 1.3.0 (MIT licensed), deployed via the official Lunar starter kit and served from
/var/www/lunar/public - nginx (TLS on :443, with :80 redirected to HTTPS) + PHP 8.3 (php8.3-fpm with OPcache) + MariaDB, all from Ubuntu 24.04 main/universe
- A per-VM self-signed TLS certificate generated on first boot, so the admin panel loads over a secure context
- The Lunar admin panel at
/lunarand the customer storefront at/, with a demo catalog seeded so the store is populated on first visit - Per-VM administrator email + password, MariaDB password and Laravel
APP_KEY, all generated at first boot and written to a root-only file — the well-known starter defaultadmin@lunarphp.io/passworddoes not ship nginx.service,php8.3-fpm.serviceandmariadb.serviceas systemd units, enabled and active- 24/7 cloudimg support

Prerequisites
An active Azure subscription, an SSH key pair, and a VNet + subnet in the target region. Standard_B2ms (2 vCPU / 8 GiB RAM) is a good starting point; scale up for larger catalogs or heavier traffic. NSG inbound: allow 22/tcp from your management network and 443/tcp (HTTPS) plus 80/tcp (which redirects to HTTPS) from your customers.
Step 1 — Deploy from the Azure Marketplace
Find Lunar on Ubuntu 24.04 LTS by cloudimg in the Azure Marketplace and choose Get It Now → Create. Pick your resource group, region, and VM size (Standard_B2ms or larger), provide your SSH public key, and allow inbound 443/tcp and 80/tcp in the networking step. Review and create.
Step 2 — Or deploy with the Azure CLI
az vm create \
--resource-group <your-rg> \
--name lunar \
--image <marketplace-image-urn> \
--size Standard_B2ms \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name lunar --port 443 --priority 1010
Step 3 — Connect to your VM
ssh azureuser@<vm-public-ip>
Step 4 — Confirm the services are running
The three services that back Lunar should all report active, the storefront answers HTTP 200 over HTTPS, and the admin sign-in page loads (the plain HTTP port redirects to HTTPS):
systemctl is-active nginx php8.3-fpm mariadb
curl -ks -o /dev/null -w 'storefront https -> %{http_code}\n' https://127.0.0.1/
curl -ks -o /dev/null -w 'admin login -> %{http_code}\n' https://127.0.0.1/lunar/login
curl -s -o /dev/null -w 'http redirect -> %{http_code}\n' http://127.0.0.1/
Expected: three lines of active, then storefront https -> 200, admin login -> 200 and http redirect -> 301.

Step 5 — Retrieve your administrator credentials
On the first boot of every VM, a one-shot service (lunar-firstboot.service) generates credentials that are unique to that VM: a fresh Laravel application key, a fresh MariaDB password, and a fresh administrator email and password. It also generates a per-VM self-signed TLS certificate and sets the VM's own address as the application URL. No shared or default credentials ship in the image — the well-known Lunar starter default admin@lunarphp.io / password is neutralised at build time and does not authenticate.
sudo cat /root/lunar-credentials.txt
The file (mode 0600, root only) contains the administrator email (lunar.admin.user), the administrator password (lunar.admin.pass), the storefront and admin URLs, and the database credentials. Lunar signs in by email at /lunar/login.

You can prove the credential round-trip from the VM's own shell — this reads the per-VM administrator credentials and confirms the rotated password verifies against the stored bcrypt hash on the lunar_staff row (and that the account carries admin rights):
ADMIN_USER=$(sudo grep '^lunar.admin.user=' /root/lunar-credentials.txt | cut -d= -f2-)
ADMIN_PASS=$(sudo grep '^lunar.admin.pass=' /root/lunar-credentials.txt | cut -d= -f2-)
HASH=$(sudo mariadb -N -B lunar -e "SELECT password FROM lunar_staff WHERE email='$ADMIN_USER';")
HH="$HASH" PP="$ADMIN_PASS" php -r 'echo password_verify(getenv("PP"),getenv("HH")) ? "admin password verifies -> OK\n" : "verify failed\n";'
Step 6 — Sign in to the admin panel
Browse to https://<vm-public-ip>/lunar and sign in with the administrator email and password from the credentials file. Because the image ships a per-VM self-signed certificate, your browser shows a one-time certificate warning on first visit — click through it, or install your own domain certificate into /etc/nginx/ssl/.

After signing in you land on the dashboard, which summarises orders, sales and reporting for your store.

Step 7 — Manage your catalog
From the admin panel's Catalog menu you manage Products, Product Types, Brands and Collection Groups. The store ships with a demo catalog so you can explore a populated storefront immediately: choose Catalog → Products to see the seeded products, or New Product to add your own — set the product type, attributes, pricing, inventory and images. Use Collection Groups to build your storefront navigation and Sales → Orders / Customers / Discounts to run the store.

Step 8 — Confirm the version and the stack
cd /var/www/lunar && composer show lunarphp/lunar | grep versions
sudo -u www-data php /var/www/lunar/artisan --version
php -v | head -1
Expected: lunarphp/lunar 1.3.0, the Laravel framework version, and PHP 8.3. Lunar runs as a Laravel application on PHP 8.3 with OPcache, served by nginx over HTTPS with php-fpm, backed by MariaDB.

First-boot service and security model
A one-shot lunar-firstboot.service runs After=mariadb.service and Before=nginx.service, so the per-VM credentials and TLS certificate are in place before the first page is ever served. It writes the credentials file at mode 0600 (root only) and drops a sentinel so it runs exactly once.
systemctl status lunar-firstboot.service --no-pager | head -6
sudo stat -c '%a %U:%G %n' /root/lunar-credentials.txt

Administration from the CLI
Admin tasks use Laravel's artisan as the www-data user, for example to list the available commands:
sudo -u www-data php /var/www/lunar/artisan list | head -30
Common operations include php artisan cache:clear, php artisan optimize (cache config and routes for production), php artisan lunar:search:index to rebuild the storefront search index, and php artisan queue:work if you move email and indexing to a queue.
Enabling HTTPS with your own domain
The image already serves HTTPS with a per-VM self-signed certificate. For production, point a real domain at the VM's public IP, open 443/tcp in the NSG, then replace the self-signed certificate with a trusted one using Let's Encrypt (replace the domain):
sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com
After the certificate is issued, set the new address as the application URL in /var/www/lunar/.env (APP_URL=https://your-domain.com), then sudo -u www-data php /var/www/lunar/artisan optimize:clear.
Backup and maintenance
The database lives at /var/lib/mysql and the application tree — code, docroot and uploaded media — at /var/www/lunar. Snapshot the OS disk in Azure for a point-in-time backup, or dump the database with (the database password is in the credentials file):
sudo mariadb-dump lunar > lunar-backup.sql
Keep the OS patched with sudo apt update && sudo apt upgrade (unattended security upgrades are enabled by default). The stack restarts cleanly with sudo systemctl restart nginx php8.3-fpm mariadb.
Support
This image is backed by 24/7 cloudimg support. Contact us by email and chat for help with Lunar deployment, upgrades, catalog and storefront configuration, payment and shipping methods, tax and pricing setup, API integration, performance tuning and database administration.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.