0

I am using a Apache HTTPd server on Fedora Linux to serve a web suite for internal use only. However, My machine has only a single public IP address.

I want to configure HTTPd to accept and serve the web pages to clients that belong to a specified IP address groups instead of serving to entire www. Is it possible to configure httpd in such a way? Or do I need to configure my machine firewall to do the same for me instead of HTTPd server?

Anirban
  • 103
  • 3

1 Answers1

2

A firewall will allow you to restrict access to the web server port, but if your web server has both public public content as well as content that you want to share only with users from specific IP-address ranges, then you need to apply access controls at the apache httpd web server level and can't use a firewall.

You typically set Apache access controls in the apache configuration file and protect a directory:

<Directory "/www/docs">
  Require ip 10 172.20 192.168.2
</Directory>

The Require ip syntax is used to grant access to users from the 10.0.0.0/8 , 172.20.0.0/16 and 192.168.2.0/24 ip-address ranges.

Please refer to https://httpd.apache.org/docs/2.4/howto/auth.html for examples on how to set up more complex access controls and authentication.

Rob
  • 1,175
  • 1
  • 7