LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-28-2013, 09:48 AM   #1
elkhedewy
LQ Newbie
 
Registered: May 2013
Posts: 6

Rep: Reputation: Disabled
how to disable direct access to my server ip ?


Hello,

I'm using apache web server, and i need to disable the direct access by ip.

When some one enter server ip at the web browser got forbidden error message instead of opening my website.

How to do that in httpd.conf ?
 
Old 05-28-2013, 10:34 AM   #2
elkhedewy
LQ Newbie
 
Registered: May 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
i Added the following in .htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} ^123\.123\.123\.123
RewriteRule ^(.*)$ - [F,L]

It works fine, But i need to do that using httpd.conf not .htaccess
 
Old 05-28-2013, 11:58 AM   #3
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Rep: Reputation: 51
Quote:
Originally Posted by elkhedewy View Post

When some one enter server ip at the web browser got forbidden error message instead of opening my website.
Is it getting forbidden message or you want the forbidden message should be appeared?

Are you talking about LAN?

Do you want that no body should access your site in LAN using your IP?
 
Old 05-28-2013, 12:07 PM   #4
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Rep: Reputation: 51
Take a look at this, may be it will solve your problem.
http://www.cyberciti.biz/faq/apache-...d-directories/
 
Old 05-28-2013, 01:56 PM   #5
elkhedewy
LQ Newbie
 
Registered: May 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
I found the solution, its by adding the following:
Code:
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /var/www/html
</VirtualHost>

Many thanks for you all
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
copying files from remote linux server with no direct access to internet !? vulovic Linux - Newbie 5 08-23-2012 12:13 AM
would like to disable direct root login using ssh/sftp rholme Linux - Newbie 4 05-17-2008 07:12 PM
FreeNX Server Not installed or NX access disable Glock23 Slackware 5 06-19-2006 10:42 AM
disable internet access to server jonfa Linux - Networking 3 06-24-2005 02:11 PM
I lose ftp access when I disable shell access for user captainObvious Linux - General 3 11-13-2004 05:49 PM


All times are GMT -5. The time now is 11:47 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration