I personally use Docker with CoreOS to solve the infrastructure problem (although I still dev against an embedded Jetty instance and then deploy on test and prod against a dockerized Jetty version, but have never had issues doing it that way), Liquibase to keep my dev and prod databases structure in sync, for configs I built my own solution to make sure that configs are sane and that if I have properties in dev config, that it's at least present in prod configs and get notified if those properties aren't being used anywhere in case I made typos.
Since I'm mostly building on the JVM, it's fairly easy to keep things consistent, I do remember the PHP, perl and Python days where even a minor version difference would cause endless problems on prod that couldn't be reproduced on dev, but I reckon even those issues can be minimised these days by developing against docker images and then deploying those same docker images.