Difference between revisions of "Apache"

From Steak Wiki
Jump to navigationJump to search
Line 35: Line 35:
 
* https://podtech.com/apache/block-ips-by-country-apache/
 
* https://podtech.com/apache/block-ips-by-country-apache/
 
* https://wiki.ubuntuusers.de/Archiv/Apache/mod_geoip2/
 
* https://wiki.ubuntuusers.de/Archiv/Apache/mod_geoip2/
 +
 +
geoip.conf
 +
<pre>
 +
<IfModule mod_geoip.c>
 +
  GeoIPEnable On
 +
  GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
 +
</IfModule>
 +
</pre>
 +
 +
/etc/apache2/sites-available/webseite-geoip
 +
<pre>
 +
<VirtualHost *>
 +
        ServerAdmin webmaster@example.com
 +
        ServerName www.example.com
 +
        ServerAlias www.example.com *.www.example.com
 +
        DocumentRoot /var/www/webseite/
 +
 +
<Directory /var/www/webseite/>
 +
        AllowOverride FileInfo Options
 +
        SetEnvIf GEOIP_COUNTRY_CODE AT AllowCountry
 +
        Deny from all
 +
        Allow from env=AllowCountry
 +
        Allow from 192.168.
 +
</Directory>
 +
 +
###### Logs ####
 +
 +
        ErrorLog /var/log/apache2/webseite.error.log
 +
        LogLevel warn
 +
        CustomLog /var/log/apache2/webseite.access.log combined
 +
</VirtualHost>
 +
</pre>
 +
  
  
 
</small>
 
</small>

Revision as of 02:52, 13 October 2020

Apache hardening: https://wiki.zoneminder.com/Ubuntu_Install_ZoneMinder_on_Ubuntu_Server


Eliminate Error Pages

Append this:

Contents of /etc/apache2/apache.conf

ErrorDocument 400 /error555.html ErrorDocument 401 /error555.html ErrorDocument 404 /error555.html ErrorDocument 403 /error555.html ErrorDocument 500 /error555.html ErrorDocument 502 /error555.html ErrorDocument 503 /error555.html ErrorDocument 504 /error555.html


Contents of /var/www/html/error555.html

Just a blank file.

Misc

enable / disable ssl (listen on port 443)

a2enmod ssl
a2dismod ssl


enable / disable certain php vers

a2enmod php5.6
a2dismod php5.5

GeoBlocking

geoip.conf

<IfModule mod_geoip.c>
  GeoIPEnable On
  GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
</IfModule>

/etc/apache2/sites-available/webseite-geoip

<VirtualHost *>
        ServerAdmin webmaster@example.com
        ServerName www.example.com
        ServerAlias www.example.com *.www.example.com
        DocumentRoot /var/www/webseite/

<Directory /var/www/webseite/>
        AllowOverride FileInfo Options
        SetEnvIf GEOIP_COUNTRY_CODE AT AllowCountry
        Deny from all
        Allow from env=AllowCountry
        Allow from 192.168.
</Directory>

###### Logs ####

        ErrorLog /var/log/apache2/webseite.error.log
        LogLevel warn
        CustomLog /var/log/apache2/webseite.access.log combined
</VirtualHost>