A few days ago we had to verify one of our websites at an affiliate partner. They provided two ways:

  1. Either insert a meta tag at our root html file.
  2. Create an empty file with a specific name for verification.

We were not permitted to insert the verification tag into the header, therefore possibility number 1 has been removed from this equation and we were left with number 2. We also did’t want to create a new file on the filesystem, because we would need to tell the Nginx server where to look and set the specific permissions.

The fastest and easiest solution was to specify a custom location matching the exact file name and return the expected HTTP-code 200 with an empty string.

This can be done quite easily in Nginx, like you can see in the following code:

location /specificFile.html {
     return 200 '';
}

Note: Yes, I know…we should return 204, because the file has no content.

Most likely you should also be able to verify your website this way on other services.