Yesterday I wrote, a little bit about my problems with wrong indexed links in Google. Today I will provide a simple guide on  how to configure Ngnix to display 404 page for not configured domains and your servers IP address.

For a basic server setup see: LEMP Server Ubuntu 12.04 for serving Drupal on Nginx

Create a dummy/default domain folder

I will use a dummy domain to redirect all wrong requests here

sudo mkdir -p /srv/www/default
sudo usermod -a -G www-data admin
sudo chown -R www-data:www-data /srv/www
sudo chmod -R 775 /srv/www

Nginx Server block config for dummy domain

sudo nano /usr/local/nginx/sites-available/default  

Paste:

server{
listen 80 default;
root /srv/www/default;
}

Enable domain

sudo ln -s /usr/local/nginx/sites-available/default /usr/local/nginx/sites-enabled/default 

Basic HTML index.html

Now create your index.html file and upload it to /srw/www/default

Restart Nginx

sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx start

Now, try to access your servers IP address in browser and you should see content from index.html file you just created.