Desktop as a service

🌐 

Overview

Migrating an application to a VPS usually includes:

  • Moving your app files
  • Moving your database (SQL or MySQL)
  • Installing dependencies (PHP, .NET, Node, Python, etc.)
  • Configuring firewall ports
  • Setting up the app as a service
  • Configuring backups
  • Testing the deployment

This guide applies to both Linux VPS (Ubuntu/Debian) and Windows VPS, depending on what your app needs.


🟩 

1. Preparing Your VPS

Before migration, make sure your VPS has:

✔ Latest security updates

Reboot if required.

✔ Enough CPU/RAM

Upgrade if the app is heavy.

✔ OpenVPN ready (if using private-network-only setup)

✔ Firewall configured

Open only the ports your app needs.

✔ Database installed

Examples:

  • SQL Server for Windows apps
  • MySQL or MariaDB for PHP apps
  • PostgreSQL for enterprise apps

✔ Web server installed (if needed)

Nginx or Apache on Linux

IIS on Windows


🟦 

2. Moving Your Application Files

There are several methods: SCP, SFTP, FTP, or shared folders.

Since SCP is fastest and most secure, here’s how to use it in plain text.

✔ From your old server (Linux → Linux)

Use this format:

“scp -r your-folder username at vps-ip:destination-path”

Example in words:

Copy the folder “app” from old server to your VPS under /var/www.

✔ From your local PC

Use an SFTP client such as WinSCP, FileZilla, or Transmit.

Steps:

  1. Open the SFTP client
  2. Enter VPS IP
  3. Use username and password
  4. Drag-and-drop your files

✔ For Windows VPS

Just use RDP → drag & drop, or upload via cloud tools (OneDrive, Google Drive).


🟧 

3. Migrating Your Database

Your app won’t run correctly until the database is moved.

If using SQL Server (on Windows VPS)

Export database

Use SQL Server Management Studio (SSMS):

  • Right-click the database
  • Choose “Tasks”
  • Export data-tier application or generate full backup

Import database

On the VPS:

  • Open SSMS
  • Restore database from the .bak file
  • Set up users and permissions

If using MySQL / MariaDB (on Linux VPS)

Export database on old server

Run something like:

“mysqldump -u user -p database-name > database.sql”

Import database on the new VPS

Transfer the database.sql file

Run something like:

“mysql -u user -p database-name < database.sql”

(All commands in plain text for safety.)


🟨 

4. Installing Dependencies

Depending on your app, install:

✔ PHP + Nginx or PHP + Apache

Most common for invoicing apps, CRMs, and ERPs.

✔ Node.js

For modern SaaS apps.

✔ Python + venv

For backend tools and scripts.

✔ .NET Runtime

For Windows apps or ASP.NET websites.

Make sure to install the exact version your app was built for.


🟪 

5. Configuring Your Application

After copying files and restoring the database:

✔ Update configuration files

Common settings to adjust:

  • Database host (often “localhost” now)
  • Database username/password
  • File paths
  • API keys
  • Storage paths

✔ Set correct file/folder permissions

Linux:

“chown -R user:user /var/www/app”

“chmod -R 755 /var/www/app”

Windows:

Right-click → Properties → Security → Grant app-specific users access.

✔ Configure environment variables

Linux: store them in .env files or systemd

Windows: System → Advanced → Environment Variables


🟥 

6. Running the App as a Service

For Linux apps running Node, Python, or custom processes:

Create a systemd service

Example in text:

Create a file in /etc/systemd/system/app.service

Inside it define the command to run your app, user, working directory, etc.

Then run:

“systemctl enable app”

“systemctl start app”

This ensures your app restarts automatically if the VPS reboots.


For Windows apps:

  • Use Task Scheduler
  • Or NSSM (Non-Sucking Service Manager) to run your .exe as a service
  • Or configure IIS for ASP.NET apps

🟫 

7. Configure Firewall Ports

If your app needs external access:

Linux UFW:

Allow port 80 (HTTP)

Allow port 443 (HTTPS)

Allow any custom ports your app requires

Windows Firewall:

Add inbound rules under “Advanced Security”.

If the app is internal-only, use VPN-only access instead of public ports.


🟩 

8. Testing the Application

After migration, test:

  • App loads in browser
  • API endpoints respond
  • Database queries work
  • File uploads work
  • SMTP/email sending works
  • Background jobs run correctly

Fix any missing dependencies or permissions.


🟦 

9. Backup Configuration

Once migration succeeds:

✔ Enable daily backups

✔ Periodic snapshots

✔ Database exports

✔ Store logs in a safe location

This protects your application from data loss or corruption.


🟧 

10. Common Migration Problems (and fixes)

❌ App loads but gives “Database connection error”

Fix: Update database host, port, user, password in config file.

❌ White screen or 500 error

Fix: Missing PHP modules, wrong file permissions, missing dependencies.

❌ CSS/JS not loading

Fix: Check your public folder paths and Nginx/Apache settings.

❌ Windows app can’t connect to SQL Server

Fix: Enable TCP/IP in SQL Server Configuration Manager and open port 1433 (or use VPN-only).

❌ Wrong file encoding after transfer

Fix: Ensure SCP or SFTP wasn’t in ASCII mode (rare but possible).

❌ Poor performance

Fix: Upgrade CPU/RAM or enable caching (Redis, memcached).


✔ 

Summary

Migrating your app to a VPS involves:

  1. Preparing the server
  2. Copying your files
  3. Moving your database
  4. Installing all dependencies
  5. Updating configuration
  6. Opening correct ports
  7. Running the app as a service
  8. Testing everything
  9. Setting up backups

When done right, your VPS becomes a stable, high-performance home for your application.