SCADA Cloud Config API — Deployment ===================================== 1. COPY FILES TO THE VPS Put the configurator + this api folder under Apache's web root: /var/www/html/config/ ├── configurator.html ├── report_engine.html ├── powerlimit.html └── api/ ├── _common.php ├── plants.php ├── upload.php ├── versions.php ├── download.php └── storage/ (created automatically on first run) (Rename this "cloud-api" folder to "api" when you copy it.) 2. PERMISSIONS — Apache (www-data) must be able to write storage/ sudo chown -R www-data:www-data /var/www/html/config/api sudo chmod -R 775 /var/www/html/config/api 3. PHP must be installed + enabled in Apache sudo apt install -y php libapache2-mod-php sudo systemctl restart apache2 4. ACCESS Open: https://YOUR-VPS/config/configurator.html The page calls api/plants.php, api/upload.php, etc. using RELATIVE paths — same origin, so no CORS setup is needed. 5. TEST THE API DIRECTLY (optional) List plants: https://YOUR-VPS/config/api/plants.php Should return: {"ok":true,"plants":[]} ENDPOINTS --------- GET api/plants.php POST api/plants.php {action:add|edit|delete, id, name} POST api/upload.php {plantId, kind:config|report, note, content} GET api/versions.php?plantId=X[&kind=config|report] GET api/download.php?plantId=X&file=Y.json STORAGE LAYOUT -------------- api/storage/plants.json (registry) api/storage//config_v_.json api/storage//config_v_.json.meta api/storage//report_v_.json NOTES ----- - No authentication yet (add an API key later if needed). - Local folder-save in the configurator is UNCHANGED and independent. - Deleting a plant removes it from the registry but KEEPS its files on disk.