Ports and Directories
Port usage and installation directory layout after deploying Mopheus.
This page explains the ports occupied and the installation directory layout after deploying Mopheus. It applies to both Online Installation and Offline Installation.
Port Overview
| Service | Default Port | Environment Variable | Exposure Recommendation |
|---|---|---|---|
| Frontend (Web) | 3000 | FRONTEND_PORT | Browser entry point; with Nginx, only the Nginx port needs public access |
| Backend (API) | 8080 | BACKEND_PORT | API / CLI / daemon entry point; with Nginx, proxy access and restrict direct connections |
| PostgreSQL | 5432 | POSTGRES_PORT | Do not expose — internal network only, or add firewall rules |
| SwissQL | 18080 | SWISSQL_PORT | Do not expose — has management endpoints (requires SWISSQL_ADMIN_TOKEN), internal network only |
Service URLs (based on .env configuration):
- Frontend:
http://<host-ip>:3000 - Backend:
http://<host-ip>:8080 - SwissQL:
http://<host-ip>:18080
Notes:
- After changing a port, restart the services (
./mopheus.sh restart) for it to take effect. - If a port is already in use, the container startup reports a port allocation error.
- If PostgreSQL or SwissQL must be reachable externally, add firewall rules and make sure a strong password /
SWISSQL_ADMIN_TOKENis set.
Nginx Reverse Proxy
When serving Mopheus through an HTTPS domain with Nginx, route frontend pages to port 3000 and API and WebSocket traffic to port 8080. The browser WebSocket uses /ws; the daemon WebSocket uses /api/v1/daemon/ws. Both locations require HTTP/1.1 and the Upgrade and Connection: upgrade headers, or the WebSocket handshake will fail.
Add these locations to the Nginx server {} block:
location /ws {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400s;
}
location = /api/v1/daemon/ws {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400s;
}
location /api/ {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}This example assumes Nginx and Mopheus run on the same host with the default ports. Replace the upstream addresses for remote hosts or custom ports. Set FRONTEND_ORIGIN and CORS_ALLOWED_ORIGINS in .env to the HTTPS domain users access.
Installation Directory Layout
The installation directory is chosen at deployment time (this doc uses /app/mopheus as an example). All persistent data lives under it:
/app/mopheus/ # Installation directory (chosen at deployment)
├── .env # Configuration file (generated by init-env)
├── docker-compose.yml # Service orchestration definition
├── data/ # All persistent data (backup focus)
│ ├── pgdata/ # PostgreSQL data
│ ├── uploads/ # Uploaded files (see object storage note below)
│ ├── swissql_data/ # SwissQL data
│ ├── swissql_audit/ # SwissQL audit logs
│ └── swissql_jdbc_drivers/ # SwissQL JDBC drivers
├── images/ # Offline container images (offline package only)
├── logs/ # Service logs
└── backups/ # Configuration snapshots created by upgradesuploads/ and Object Storage
data/uploads/ is the default local storage location — all uploaded attachments are saved here.
You can also switch storage to an S3-compatible object storage in the admin panel (Admin → System Configuration), with s3, oss, obs, cos, and minio drivers supported. Once switched, uploads no longer land in data/uploads/ but in the object storage bucket. See Admin Panel — System Configuration for the configuration keys and endpoint formats per cloud provider.
Restart the services after changing any storage setting for it to take effect.
Backup and Migration
All persistent data lives under data/ in the installation directory:
- Backup: keep at least the entire
data/directory and the.envconfiguration file. - Migration: copy the whole installation directory to the new server (the path may differ) and run
./mopheus.sh start-server. - Upgrade: before changing files, the upgrade script automatically creates a configuration snapshot at
backups/<old-version>-<timestamp>/. Data indata/is never deleted.