Create two virtual host files (adjust paths and domains).

Enable sites

Required modules

Enable modules required for reverse proxy and WebSocket support:

Frontend vhost — app.your-domain.com

File: /etc/apache2/sites-available/app-your-domain.conf
The rewrite rules ensure React Router paths work on refresh (SPA fallback to index.html).

API vhost — api.your-domain.com

File: /etc/apache2/sites-available/api-your-domain.conf Replace 5000 if your backend PORT env differs.
After editing:

Frontend static deploy

Vite bakes environment variables at build time. Set production values in .env before running yarn build.

Production .env (example)

Create or edit .env in the ReactJS project root:

Build and deploy

On the server or a build machine:
Copy the output to Apache docroot:
Or upload the build/ folder via MobaXterm SFTP. Important: If you change VITE_APP_BASEURL or VITE_APP_SOCKET_URL, you must rebuild and redeploy the frontend. A backend-only deploy is not enough.