| Dieser Inhalt in deutsch |

Debian - Apache - accept requests from a specific subnet

Problem

A web server in the intranet on Debian Wheezy should only answer questions from his own Subnet.

Solution

Change the rule to deny any access and allow only requests from the specific subnet

Edit file /etc/apache2/sites-available/default

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
# rule to deny any access and allow requests from a specific subnet
#Order allow,deny
#allow from all
Order deny,allow
deny from all
allow from 10.200.32.0/22
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Let changes take effect

# /etc/init.d/apache2 reload