Change default page for subdomain?

Abe Miessler asked:

I am trying to add a subdomain and I would like it to display a different default page than my site would without a subdomain. So displays index.html by default. I would like to display sub.html.

I am able to get my nginx server to handle the subdomain requests with the setup below:

server {
        listen 80;

But it just goes to the default page for the main site. How can I tell nginx that if the subdomain is used it needs to return a specific HTML file?

My answer:

Create a new server block for your new subdomain.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.