LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-18-2011, 02:42 AM   #1
deepak_message
Member
 
Registered: Oct 2007
Posts: 175

Rep: Reputation: 17
How to stop IP based hosting in virtual hosting


Hi,

I have designed name based virtual hosting in apache. as of now, I am able to access website using IP also. which is I am looking to block, only can access by the name.

please help.
 
Old 08-18-2011, 04:18 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Well you can't stop it at *every* level, but if you just create another dummy virtualhost *ABOVE* the proper one then that will e used as the default site (i.e. when no name is provided) and that site can just be a denial page or something.
 
Old 08-18-2011, 08:29 AM   #3
deepak_message
Member
 
Registered: Oct 2007
Posts: 175

Original Poster
Rep: Reputation: 17
Thanks for the reply. most of the places, I have seen that multiple website hosted on same server. and if try to access from an IP, it does not work.
I have configured the same structure, but I do also able to access the website. so looking to prevent the website access from IP.
 
Old 08-18-2011, 08:37 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well yes, that's what I already described.
 
Old 08-18-2011, 09:15 AM   #5
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by deepak_message View Post
Thanks for the reply. most of the places, I have seen that multiple website hosted on same server. and if try to access from an IP, it does not work.
I have configured the same structure, but I do also able to access the website. so looking to prevent the website access from IP.
'it does not work' is very broad; can you be more specific?

If I ping my domain (hosted at a hosting provider), I get 74.53.231.98
If I enter that in the address bar, I don't get my domain but a page that says
Quote:
This is the Plesk™ default page

If you see this page it means:
1) hosting for this domain is not configured
or
2) there's no such domain registered in Plesk.
For more information please contact Administrator.
That page just as well could have been an empty page, but is definitely not my website.

If that is what you want, follow acid_kewpie's advise. Else give an example of an ip address that we can check.
 
Old 08-19-2011, 12:36 AM   #6
deepak_message
Member
 
Registered: Oct 2007
Posts: 175

Original Poster
Rep: Reputation: 17
Wim Sturkenboom, you are correct. I am not looking to access using website.

See, the picture is I have configured two domain name on the same IP.
like,

------> /etc/hosts

192.168.0.1 abc1.abc.com
192.168.0.1 abc2.abcd.com


---- > /etc/httpd/conf/httpd.conf

VirtualHost 192.168.0.1*80

<virtualHost abc1.abc.com:80>
DocumentRoot abc1.html
</VirtalHost>


<virtualHost abc2.abcd.com:80>
DocumentRoot abc2.html
</VirtalHost>

Now, when I am accesing website through abc1.abc.com, it accesses page abc1.html
and accessing through abc2.abcd.com , it accesses page abc2.html.

the problem is, when I am accessing through IP(192.168.0.1), able to access of the domain of abc1.abc.com. I am looking if i do access using IP, it should be work.


thanks
 
Old 08-19-2011, 12:50 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
As acid_kewpie said,

Code:
VirtualHost 192.168.0.1*80

<virtualHost catchip:80>
DocumentRoot catchip.html
</VirtalHost>


<virtualHost abc1.abc.com:80>
DocumentRoot abc1.html
</VirtalHost>

<virtualHost abc2.abcd.com:80>
DocumentRoot abc2.html
</VirtalHost>
Modify the bold block to your needs. Make an index.html page (in catchip.html) saying something like '!! error !!'. A request for the IP address (or e.g. abc3.com) will end up showing '!! error !!'.

Last edited by Wim Sturkenboom; 08-19-2011 at 12:53 AM.
 
Old 08-19-2011, 01:12 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by deepak_message View Post
Wim Sturkenboom, you are correct. I am not looking to access using website.
the problem is, when I am accessing through IP(192.168.0.1), able to access of the domain of abc1.abc.com. I am looking if i do access using IP, it should be work.
Dude, you *REALLY* need to pay attention to the advice you are given. We all know EXACTLY what you mean. Instead of just asking your question repeatedly, READ the replies you've already got.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IP based Virtual Hosting sandeepthug Linux - Server 2 04-15-2010 06:30 AM
virtual name based hosting atomicrm Linux - Server 8 12-17-2009 09:20 AM
[SOLVED] FTP name based Virtual Hosting mwkemo Linux - Server 5 08-24-2009 09:47 AM
name based virtual hosting jkmartha Linux - Software 4 08-04-2005 09:21 AM
name based virtual hosting adm1329 Linux - Networking 5 05-05-2004 11:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration