ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل NAFI RAHMAN KATTIL PUTHIYA PURA , IT Support Engineer , Cleveland Clinic Abu Dhabi
تاريخ النشر: 2014/01/31
مستخدم محذوف‎
من قبل مستخدم محذوف‎

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
من قبل 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
من قبل kalaiarasan V , System Analyst , Syntel

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

مستخدم محذوف‎
من قبل مستخدم محذوف‎

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

Require not ip X.X.X.X 

Muhammad Anzar
من قبل 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>

 

 

 

مستخدم محذوف‎
من قبل مستخدم محذوف‎

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]

 

عبدالرزاق رحمون
من قبل عبدالرزاق رحمون , 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/

المزيد من الأسئلة المماثلة