Setting Up The Virtual Host
NGINX Configuration
As target for the rewritten HTTP requests from browsers, I set up a virtual host on intraweb.mydomain.
I create a document root for the virtual host:
~# mkdir /var/www-empty
I set up an NGINX site empty by creating a new file /etc/nginx/sites-available/empty.
I bind the virtual host specifically to the dedicated IP address 192.168.2.60 I have reserved for this purpose.
I rewrite every request to location /empty.gif. The last modifier will avoid an infinite redirect loop.
I use the empty_gif builtin of NGINX to directly serve a 1 x 1 transparent pixel GIF without having to store it on disk.
# file /etc/nginx/sites-available/empty:
server {
listen 192.168.2.60:80;
root /var/www-empty;
rewrite .* /empty.gif last;
location = /empty.gif { empty_gif; }
}
I enable the site by symlinking it in sites-enabled:
~# cd /etc/nginx/sites-enabled
sites-enabled# ln -s ../sites-available/empty
I restart the webserver:
~# service nginx restart
Test
From a workstation where this is supposed to take effect, I test that the virtual host for empty is reachable and replies as expected by requesting arbitrary paths from it, it should always reply with the same (empty) image/gif content:
~$ curl -IL http://empty.mydomain/whatever
HTTP/1.1 200 OK
Server: nginx/1.9.2
Date: Fri, 28 Aug 2015 04:54:20 GMT
Content-Type: image/gif
Content-Length: 43
Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT
Connection: keep-alive