Hi I am running my website in Linux VPS with dedicated IP few weeks ago I found someone else domain is pointing to my website
嗨我几周前在Linux VPS中使用专用IP运行我的网站我发现其他域名指向我的网站
Ex :: mydomain.com === server my site content
otherdomain.com === also server my site content
If I update or modify its getting updated on other domain too..
如果我更新或修改其在其他域上的更新...
please need help any settings to prevent this
请帮助任何设置,以防止这种情况
after searching many forums I found the name based virtual host how to implement this in VPS Linux please guide me or any other solution for this issue please help
在搜索了很多论坛之后,我发现基于名称的虚拟主机如何在VPS Linux中实现这个,请指导我或者此问题的任何其他解决方案请帮助
I also try to see the reverse IP lookup my IP shows two domain another 1 is bad domain is pointing my server/ IP but it server my site content ..how to stop this please help
我也尝试看到反向IP查找我的IP显示两个域另一个是坏域指向我的服务器/ IP但它服务器我的网站内容..如何停止这请帮助
2 个解决方案
#1
3
If the domain is not yours there is no way to like.. not point it to your server, however you can point it to a serperate page by using VirtualHost's
如果域名不是您的域名,则无法将其指向您的服务器,但是您可以使用VirtualHost将其指向一个serperate页面。
Do this by doing the following, create a folder with a desired html / php file inside saying that the page is not existing or whatever
通过执行以下操作来执行此操作,创建一个包含所需html / php文件的文件夹,其中包含该页面不存在或其他任何内容
then edit your VirtualHosts file, let's say your using apache, that file would be in the following directory: /etc/apache2/sites-available/
open the file called default
and add the following code:
然后编辑你的VirtualHosts文件,假设你使用apache,该文件将在以下目录中:/ etc / apache2 / sites-available /打开名为default的文件并添加以下代码:
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example.org
</VirtualHost>
#2
10
I agree with @Azrael but would like to expand on it:
我同意@Azrael,但想扩展它:
You can redirect their domain to a different page on a case by case basis but what I would recommend doing and what I do on most of my servers is deny all traffic except the traffic for the correct domain.
您可以根据具体情况将其域重定向到其他页面,但我建议您在大多数服务器上执行操作以及拒绝除正确域的流量之外的所有流量。
Apache 2.4 and newer:
Apache 2.4及更新版本:
<VirtualHost *:80>
ServerName catchall
<Location />
Require all denied
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName allowed.com
<Location />
Require all granted
</Location>
</VirtualHost>
Apache 2.2 and older:
Apache 2.2及更早版本:
<VirtualHost *:80>
ServerName catchall
<Location />
Order allow,deny
Deny from all
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName allowed.com
<Location />
AllowOverride All
Order allow,deny
allow from all
</Location>
</VirtualHost>
The way this works is that Apache uses the ServerName to filter requests, however any requests that do not match any VirtualHosts ServerNames are sent to the first VirtualHost on the server, in this case the ServerName in the first VirtualHost is 'Catchall' which will not match any requests as it is not a valid domain name but will instead, as it is the first VirtualHost, serve all non matching domains. We then use the location container to define the allow or deny directives.
这种方式的工作方式是Apache使用ServerName来过滤请求,但是任何与任何VirtualHosts ServerNames都不匹配的请求都会被发送到服务器上的第一个VirtualHost,在这种情况下,第一个VirtualHost中的ServerName是'Catchall',它不会匹配任何请求,因为它不是有效的域名,而是因为它是第一个VirtualHost,它将服务于所有不匹配的域。然后,我们使用location容器来定义allow或deny指令。
If you want to use file system instead of url specific directives such as 'Allow overide all' you can use the directory container instead of location in the following format:
如果要使用文件系统而不是url特定指令(例如“Allow overide all”),则可以使用以下格式的目录容器而不是位置:
DocumentRoot /var/www/html
<Directory "/var/www/html">
Require all granted
Allow overide all
</Directory>
#1
3
If the domain is not yours there is no way to like.. not point it to your server, however you can point it to a serperate page by using VirtualHost's
如果域名不是您的域名,则无法将其指向您的服务器,但是您可以使用VirtualHost将其指向一个serperate页面。
Do this by doing the following, create a folder with a desired html / php file inside saying that the page is not existing or whatever
通过执行以下操作来执行此操作,创建一个包含所需html / php文件的文件夹,其中包含该页面不存在或其他任何内容
then edit your VirtualHosts file, let's say your using apache, that file would be in the following directory: /etc/apache2/sites-available/
open the file called default
and add the following code:
然后编辑你的VirtualHosts文件,假设你使用apache,该文件将在以下目录中:/ etc / apache2 / sites-available /打开名为default的文件并添加以下代码:
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example.org
</VirtualHost>
#2
10
I agree with @Azrael but would like to expand on it:
我同意@Azrael,但想扩展它:
You can redirect their domain to a different page on a case by case basis but what I would recommend doing and what I do on most of my servers is deny all traffic except the traffic for the correct domain.
您可以根据具体情况将其域重定向到其他页面,但我建议您在大多数服务器上执行操作以及拒绝除正确域的流量之外的所有流量。
Apache 2.4 and newer:
Apache 2.4及更新版本:
<VirtualHost *:80>
ServerName catchall
<Location />
Require all denied
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName allowed.com
<Location />
Require all granted
</Location>
</VirtualHost>
Apache 2.2 and older:
Apache 2.2及更早版本:
<VirtualHost *:80>
ServerName catchall
<Location />
Order allow,deny
Deny from all
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName allowed.com
<Location />
AllowOverride All
Order allow,deny
allow from all
</Location>
</VirtualHost>
The way this works is that Apache uses the ServerName to filter requests, however any requests that do not match any VirtualHosts ServerNames are sent to the first VirtualHost on the server, in this case the ServerName in the first VirtualHost is 'Catchall' which will not match any requests as it is not a valid domain name but will instead, as it is the first VirtualHost, serve all non matching domains. We then use the location container to define the allow or deny directives.
这种方式的工作方式是Apache使用ServerName来过滤请求,但是任何与任何VirtualHosts ServerNames都不匹配的请求都会被发送到服务器上的第一个VirtualHost,在这种情况下,第一个VirtualHost中的ServerName是'Catchall',它不会匹配任何请求,因为它不是有效的域名,而是因为它是第一个VirtualHost,它将服务于所有不匹配的域。然后,我们使用location容器来定义allow或deny指令。
If you want to use file system instead of url specific directives such as 'Allow overide all' you can use the directory container instead of location in the following format:
如果要使用文件系统而不是url特定指令(例如“Allow overide all”),则可以使用以下格式的目录容器而不是位置:
DocumentRoot /var/www/html
<Directory "/var/www/html">
Require all granted
Allow overide all
</Directory>