Wishlist 0 ¥0.00

如何禁止用ip直接访问到我的服务器?

如何禁止用ip直接访问到我的服务器?

windows下关闭或取消主机名空的站点
打开Internet 信息服务(IIS)管理器-如图1所示,关闭站点或者删除空主机名的绑定
图1:

linux下利用apache的虚拟主机机制,没有绑定的域名或者ip直接访问时会访问到第一个虚拟主机
注:以下操作都需远程登录ssh执行命令
centos-默认apache:
编辑配置文件
vi /etc/httpd/conf/httpd.conf
在NameVirtualHost *:80下任意添加一个虚拟主机配置,如
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName www.test.com
<Directory "/var/www/html">
deny from all
</Directory>
</VirtualHost>
重启服务即可
service httpd restart

centos-wd:
只需删除一个文件即可
rm -f /www/web/default/index.php

ubuntu:
vi /etc/apache2/ports.conf
在NameVirtualHost *:80下任意添加一个虚拟主机配置,如
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName www.test.com
<Directory "/var/www/html">
deny from all
</Directory>
</VirtualHost>
重启服务即可
/etc/init.d/apache2 restart

About Us

Since 1996, our company has been focusing on domain name registration, web hosting, server hosting, website construction, e-commerce and other Internet services, and constantly practicing the concept of "providing enterprise-level solutions and providing personalized service support". As a Dell Authorized Solution Provider, we also provide hardware product solutions associated with the company's services.
 

Contact Us

Address: No. 2, Jingwu Road, Zhengzhou City, Henan Province

Phone: 0086-371-63520088 

QQ:76257322

Website: 800188.com

E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.