Skip to content

VPS Deployment & Nginx Architecture

The Planovi Microservices are hosted on the Planovi Linux VPS (191.218.165.149) behind an Nginx reverse proxy running PHP 8.3 FPM.


1. Nginx Virtual Host Configuration

Each subdomain is routed to the respective subdirectory within the microservices deployment:

/etc/nginx/sites-available/dev-dealflow.planovi.app
server {
listen 443 ssl http2;
server_name dev-dealflow.planovi.app dealflow.planovi.app;
root /var/www/planovi-microservices/dealflow;
index index.php offer.php inquiry.php;
ssl_certificate /etc/letsencrypt/live/planovi.app/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/planovi.app/privkey.pem;
location / {
try_files $uri $uri/ =404;
}
# Protect internal data directory from direct web access
location ^~ /data/ {
deny all;
return 403;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
/etc/nginx/sites-available/dev-scheduler.planovi.app
server {
listen 443 ssl http2;
server_name dev-scheduler.planovi.app scheduler.planovi.app;
root /var/www/planovi-microservices/scheduler;
index index.php;
ssl_certificate /etc/letsencrypt/live/planovi.app/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/planovi.app/privkey.pem;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Protect internal data directory from direct web access
location ^~ /data/ {
deny all;
return 403;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

2. Directory Permissions

The PHP-FPM worker process runs under the www-data user on Ubuntu/Debian. The dynamic data/ directories must be writable:

Terminal window
# Set ownership to web server user
sudo chown -R www-data:www-data /var/www/planovi-microservices/dealflow/data
sudo chown -R www-data:www-data /var/www/planovi-microservices/scheduler/data
# Grant read/write permissions to directory
sudo chmod -R 775 /var/www/planovi-microservices/dealflow/data
sudo chmod -R 775 /var/www/planovi-microservices/scheduler/data

3. Continuous Deployment via Webhooks

Updates pushed to main or develop trigger automatic updates on the VPS via the deployment webhook listener:

  1. git pull origin main
  2. cd scheduler && composer install --no-dev --optimize-autoloader
  3. sudo systemctl reload php8.3-fpm