The problem
An audit of the server found what usually builds up on a box that grew one feature at a time. The API processes were started by hand, with nothing to restart them after a crash or a reboot. There was no swap on a machine with 2 GB of memory. The web server still accepted TLS 1.0 and 1.1. A database admin tool was listening on an open port. A stray copy of a secrets file sat next to the application. And the web server configuration existed only on the server itself.
The tempting answer is a rebuild on containers or Kubernetes. For one small server and a team of this size, it would have cost months and fixed nothing the users could see.
What we did
Fixed the dangerous findings first. The APIs became systemd services, bound to localhost behind a default-deny firewall that only lets in SSH and web traffic. We added swap, restricted TLS to 1.2 and 1.3, stopped the admin tool, deleted the stray secrets file and added fail2ban against login and scanner probes. Staging and production were split into two databases (production on managed PostgreSQL) and two separate processes.
Put the configuration in code. All 11 web server configs are now rendered from the repository by Ansible, and a drift check compares the live files with the repo. The four configs that had been set up by hand were exactly the four that had drifted. One stale template would have made the staging site visible to search engines the next time it ran.
Made every deploy reversible. Each frontend release builds into its own directory, and the live site switches to it only after the build succeeds. Rollback is one command, and the last three releases stay on disk. Frontend-only and backend-only deploys keep small changes small.
Ran a dry run before trusting the deploy script. Product images are stored on the server, not in git. The dry run showed that a full deploy would delete 284 live product images, and that those images were all of its deletions. One exclude rule in three scripts fixed it before it happened.
Made problems visible before users report them. We added a health endpoint that checks the database, external uptime checks, an hourly scripted user journey through the site, and nightly staging backups with a written restore runbook. When an automatic kernel update rebooted the server, the analytics service stayed down for 17 hours because Docker was not enabled at boot. We fixed it live and in Ansible, so it cannot drift back.
Cleaned up for search engines. Staging and private portals now answer with noindex headers and a blocking robots.txt. Scanner paths like /wp-admin or /.env get a real 404 instead of the app’s homepage. A public endpoint got a rate limit on all six paths that reach it, not only the obvious one.
What is next
The AWS resources themselves are the next step. The production database settings, seven-day backups and deletion protection, are already written in Terraform, and the rest of the account follows. We did it in this order on purpose: first make the running system safe, then make it reproducible.
What it shows
Production readiness does not need a new platform. It needs the boring basics done in the right order, written down in code, with every risky change rehearsed first.