This seems like a simple question, but after some Google searching I can't seem to find the answer.
I have a staging server where I would like to mimic the production server as much as possible. Let's say I own example.com
and I decide that I want to host a blog using blog.example.com
. I would like to be able to stage the blog before I push it to production using the staging address blog.stage.example.com
. I rather do this than buy another domain such as stage-example.com
or use naming conventions like blog-stage.example.com
.
Obviously, I would want blog.stage.example.com
to point to the server running on the staging environment (e.g. IP 1.1.1.1), and blog.example.com
to point to the server running on the production environment (e.g. IP 2.2.2.2).
I am using Nginx for my web back-end and have Gandi as a hosting provider where I manage my DNS zone file.
Is it possible to configure my domain names with the multi-level subdomains? Or, am I stuck with naming conventions like, blog-stage.example.com
? Or, perhaps there is a better way to manage this that I don't know about?
If it is possible, what would the DNS zone file look like?
And finally, if it is possible, what would the Nginx configuration file look like?