Configuring an Nginx default website

I’m configuring Nginx as my primary web server, with other Apache servers behind it, and I wanted to configure Nginx to serve up a blank page whenever someone tried to hit my server’s IP address, instead of one of the websites that’s hosted on the server. That is, I wanted to serve up a blank page rather than the default Nginx page.

In short, I added this setup information to my nginx.conf configuration file:

# ---------------------------------------------------------
# default (in case anyone tries to hit http://100.200.200.50)
# ---------------------------------------------------------

server {
    server_name  100.200.200.50;
    listen       80;
    root         /var/www/default;
    index        index.html;
}

Now, whenever someone tries to hit that URL (something like http://100.200.200.50), they’ll see my index.html page, rather than the default Nginx page. (That’s not the real IP address, just an example one.)