Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

In Apache, How do i disable access to a website when someone only uses ip address in web browsers?

I want to disable access to website when someone uses http://123.1.1.1 or https://123.1.1.1, but same time it should be accessible via fqdn.

user-image
Question ajoutée par NAFI RAHMAN KATTIL PUTHIYA PURA , IT Support Engineer , Cleveland Clinic Abu Dhabi
Date de publication: 2014/01/31
Utilisateur supprimé
par Utilisateur supprimé

If you use apache virtual host you can set default virtual host simply by entry:

<VirtualHost *>

DocumentRoot /default_dir

</VirtualHost>

and without ServerAlias or ServerName, then you should setup second virtual host with domain name

<VirtualHost *>

ServerAdmin

DocumentRoot /home/dir

ServerName www.example.com

</VirtualHost>

so with that configuration if server get IP it should point to default directory but with domain in heders it sould point to this domain directory.

Satyaveer Arya
par Satyaveer Arya , System Engineer , InterGlobe Technologies

To set-up visitors restrictions and blocking, create a .htaccess file following the main instructions and guidance which includes the following text example:

 

order allow,deny

deny from 255.0.0.0

deny from 123.45.6.

allow from all

kalaiarasan V
par kalaiarasan V , System Analyst , Syntel

Just add the Ip address Instead of website address in "ServerName" paremeter at httpd.conf file

Utilisateur supprimé
par Utilisateur supprimé

by using the module authz_host (RequireAll, RequireAny, RequireNone)

Require not ip X.X.X.X 

Muhammad Anzar
par Muhammad Anzar , DevOps/DevSecOps Architect , Confidential

You can restrict following ways for IP Based browsing. Normally you will point fqdn with directory pat

 

a) First option using limit 

 

<Limit GET POST PUT> order deny,allow deny from all allow from192.168. deny from104.113. </Limit>

 

b) Restrict virtual directory path

 

<Location /jobs> Order deny,allow deny from all allow from192.168. allow from104.113. </Location> <Location /apples> Order deny,allow deny from all allow from192.168. allow from104.113. </Location>

 

 

 

Utilisateur supprimé
par Utilisateur supprimé

You can do this using the .htaccess file. Just create one and paste in it the following lines and change the IP address to your server's:

 

RewriteEngine onRewriteCond %{HTTP_HOST} ^123.1.1.1$RewriteRule ^(.*)$ - [F,L]

 

عبدالرزاق رحمون
par عبدالرزاق رحمون , IT engineer , Ministry of Education

in .htaccess write

Order Deny,Allow

Deny from 123.1.1.1

for more info http://www.htaccesstools.com/block-ips/

More Questions Like This