How to block other domains to play and access my files?

Hello. i installed on one VPS a website, wordpress and it is domian.com. Then i upload a videos on that domain.

then i have a another vps and website seconddomain.com

But if i copy mp4file urls from domain.com and put it on seconddomain.com it can be played. I want to allow only one domain for example seconddomain.com and block all of other websites to play my mp4 files.

I use cloduflare for both domians. Is it via ngnix possible?

Please check

Used on my website after I got on 500 euro / month extra bill for over usage and Cloudflare “banned” the website from his system or I had to pay 7000 euro / month

But cloudflare is free? or not?

and how can i configure it, is so correct?

`    ``
    location ~* ^.+\.(mp4|webm|mp3|ogg|ogv)$ {
         proxy_cache    off;
             secure_link $arg_md5,$arg_expires;
             secure_link_md5 "$secure_link_expires$uri secret-pass";
             if ($secure_link = "") {
                return 403; 
             }
             if ($secure_link = "0") {
                return 403; 
             }
         root           %sdocroot%;
             access_log     /var/log/%web_system%/seconddomain.com/%seconddomain.com%.log combined;
             access_log     /var/log/%web_system%/seconddomain.com/%seconddomain.com%.bytes bytes;
        }
    ```

Cloudflare is “free” how ever if you more than “fair” use they can charge you money or require payment. It is still a commercial product that needs to make profit…

If you re using Nginx + Apache2 put those files in /usr/local/hestia/data/templates/web/nginx/

For Nginx you will need to modify your current template and place it in the server { } as above…

To get it working you will need to has all your video’s

The plugin that is included will just convert all video urls in post…

The default “key” is currently the username allowing the template to be installed on multiple sites with out an predictable outcome…

Incase of Wordpress will probably work fine

Is that correct for seconddomain.com?

server {
    listen      %ip%:%proxy_ssl_port% ssl http2;
    server_name %domain_idn% %alias_idn%;
    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;
    ssl_stapling on;
    ssl_stapling_verify on;
    error_log  /var/log/%web_system%/domains/%seconddomain.com%.error.log error;

    include %home%/%user%/conf/web/%seconddomain.com%/nginx.hsts.conf*;


    location = /xmlrpc.php {
        deny all;
        access_log off;
    }

    location / {
        proxy_pass      https://%ip%:%web_ssl_port%;

        proxy_cache cache;
        proxy_cache_valid 15m;
        proxy_cache_valid 404 15m;
        proxy_no_cache $no_cache;
        proxy_cache_bypass $no_cache;
        proxy_cache_bypass $cookie_session $http_x_update;

	location ~* ^.+\.(mp4|webm|mp3|ogg|ogv)$ {
	     proxy_cache    off;
             secure_link $arg_md5,$arg_expires;
             secure_link_md5 "$secure_link_expires$uri %user%";
             if ($secure_link = "") {
                return 403; 
             }
             if ($secure_link = "0") {
                return 403; 
             }
	     root           %sdocroot%;
             access_log     /var/log/%web_system%/seconddomain.com/%seconddomain.com%.log combined;
             access_log     /var/log/%web_system%/seconddomain.com/%seconddomain.com%.bytes bytes;
        }


        location ~* ^.+\.(%proxy_extentions%)$ {
            proxy_cache    off;
            root           %sdocroot%;
            access_log     /var/log/%web_system%/seconddomain.com/%seconddomain.com%.log combined;
            access_log     /var/log/%web_system%/seconddomain.com/%seconddomain.com%.bytes bytes;
            expires        1h;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   %home%/%user%/web/%seconddomain.com%/document_errors/;
    }

    location @fallback {
        proxy_pass      https://%ip%:%web_ssl_port%;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include %home%/%user%/conf/web/%seconddomain.com%/nginx.ssl.conf_*;
}

It should be ran on the domain that you want to protect…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.