[SOLVED] Redhat/Apache 2.2.3 - Only allow single IP to access test site?
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Redhat/Apache 2.2.3 - Only allow single IP to access test site?
Hello all,
What I am trying to do is set up a virtual host for testing grounds that only my IP address will have access to. It seems no matter how I configure the virtual host in my httpd.conf file, it sends traffic to the default apache page.
Here is my config for the virtual host:
Code:
<VirtualHost *:80>
Servername test.example.com
DocumentRoot /path/to/test
<Directory /path/to/test>
Options -Indexes ExecCGI SollowSymLinks
Order Deny,Allow
Deny from all
Allow from 123.45.67.89
</Directory>
</VirtualHost>
I don't see where I have gone wrong. If I set it to Allow from all - it works fine.
The authz_host_module is enabled and loaded.
Thank you in advance, this is becoming quite frustrating.
I set my httpd.conf Virtual host to just have the options set and AllowOverride All then pasted the code setting you posted in an .htaccess file in the test directory.
Still sends me to a apache default page.
I just don't understand why it ignores all of the settings.
I've nothing else clever to suggest, except ensure you've the right IP address, if you're accessing the site from the server then try adding 127.0.0.1 as an Allowed IP.
<VirtualHost *:80>
Servername test.example.com
DocumentRoot /path/to/test
<Directory /path/to/test>
Options -Indexes ExecCGI SollowSymLinks
Order Deny,Allow
Deny from all
Allow from 123.45.67.89
</VirtualHost>
Brain fade on my part, you're missing the </Directory> directive to close that block before the </VirtualHost>, so my guess is that your vhost isn't actually active and you're getting sent to the default site pages.
Don't understand why the port would matter...All of my other vhosts run on it
The document root declaration within the virtual host is where my index file resides for the testing site. All of the other virtual hosts on this server are setup the same way and work.
The only difference with this test site is I am trying to deny traffic from the outside world and only give access to my ip address.
When I comment out:
Code:
Allow from 123.45.67.89
And change it to:
Code:
Allow from all
It works without any issue on port 80.
I don't know why, but but that very line breaks it. It then sends to the default page.
Now I understand what you mean, this only works on sub dirs
I'm not sure why, maybe it's the apache version, but on my home testing server (debian:apache 2.2.16) it worked fine.
On the production server (RHEL:2.2.3) it will not work.
-mtlhd
Last edited by mtlhd; 10-29-2013 at 02:22 PM.
Reason: found my answer to be untrue
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.