checking and reading cookies with nginx

Please be aware that using if within a location might not work as expected, specially when used together with try_files. See: https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/

Please try this:

server {

    listen 80;

    root /home/minou/vids/;
    index index.html index.htm;

    #server_name localhost;

    if ($cookie_fileURI = "6509fd1e420bba") { return 403; }

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to index.html

        try_files $uri $uri/ /index.html;
    }

    # anti hotlinking
    location ~* \.(jpg)$ {
        valid_referers none blocked mywebsite.com www.mywebsite.com;
        if ($invalid_referer) { return 403; }
    }

}