2017-09-26 38 views
-1

我已經設置.htaccess文件來重寫任何不需要的域指向我的VPS - 只有一個域被修改。我想完全阻止這個域名訪問我的原始IP地址,所以我需要IP桌面幫助 - 以及如何停止將targetdomain.com鏈接到我的網站!.htaccess重寫的作品,但我想阻止域顯示來源。 IPTables

任何人都可以告訴我在Origin Server上需要做什麼才能拒絕來自目標域的訪問和轉發!

+1

您無法阻止其他人擁有指向您服務器的DNS條目,但您可以爲該域名創建VirtualHost,並將該VirtualHost配置爲始終爲任何URL提供錯誤頁面。 iptables不處理域名 - 你將無法使用它來阻止域名。 –

+0

我將如何使用虛擬主機代碼來停止某個DNS指向? – InfamyStudio

+0

將此轉換爲答案,所以我有空間來解釋,給我一點時間... –

回答

0

您無法阻止其他人擁有指向您服務器的DNS條目,但可以爲該域名創建VirtualHost,並將VirtualHost配置爲始終爲任何URL提供錯誤頁面。你提到了iptables,但iptables不處理域名 - 你將無法使用它來阻止域名。

這裏是一個非常簡單的虛擬主機配置,你可能把你的Apache配置文件:

<VirtualHost *:80> 
    DocumentRoot "/path/to/some/folder" 
    # You can only have one ServerName which is the main domain that 
    # you want to block, but if you have additional domains to block, 
    # you can add them with ServerAlias directives. 
    ServerName baddomain.com 
    ServerAlias another.baddomain.com 

    # This redirects all requests on this domain to index.html, so 
    # that visitors will see your message no matter what path they 
    # go to. 
    RewriteEngine On 
    RewriteCond %{REQUEST_URI} !=/index.html 
    RewriteRule^/index.html [R=302] 
</VirtualHost> 

現在,文件夾/path/to/some/folder(你應該與你的服務器上的實際文件夾路徑替換)內,只需創建一個index.html文件,其中包含您希望向訪問此域的任何人展示的任何消息。

例子:

<!doctype html> 
<html> 
<head> 
    <title>Blocked domain</title> 
</head> 
<body> 
    <h1>Blocked domain</h1> 
    <p>The domain name you tried to connect to is blocked.</p> 
</body> 
</html> 

或者,你可以把它重定向到另一個網站或其他任何 - 對mod_alias中或mod_rewrite的有關如何做到這一點的信息閱讀起來。

+0

嗨,我真的需要幫助,這個 - 你可以添加我的任何東西,沒有任何作品 - 我甚至不知道我的血腥.htaccess是工作 - 我不知道即將面臨的困境和壓力如何 – InfamyStudio