Dies ist eine alte Version des Dokuments!
Apache 2.2 unter Debian 5.0 einrichten:
apache2-mpm-prefork wegen PHP):# aptitude install apache2 apache2-mpm-prefork
# /etc/init.d/apache2 stop
# a2enmod rewrite
Timeout).ServerTokens und ServerSignature).# vi /etc/apache2/apache2.conf Timeout 60 # war: 300
# vi /etc/apache2/conf.d/security ServerTokens Minimal # war: Full ServerSignature Off # war: On
# vi /etc/apache2/conf.d/security-local
#
# Deny access to various files that should not be present on the server.
#
<FilesMatch "(^~$|\.bak$|\.BAK$)">
Order allow,deny
Deny from all
</FilesMatch>
#
# Deny access to complete filesystem.
#
<Directory />
Order deny,allow
Deny from all
Options none
AllowOverride none
</Directory>
#
# Deny access to directories that should not be present on the server.
#
<DirectoryMatch /CVS/>
Order allow,deny
Deny from all
</DirectoryMatch>
# vi /etc/apache2/apache2.conf LogLevel info # war: warn [...] # # Define an access log for VirtualHosts that don't define their own logfile #CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined # # Don't log if environment variable dontlog is set (see conf.d/dontlog). CustomLog /var/log/apache2/access.log vhost_combined env=!dontlog
# vi /etc/apache2/conf.d/dontlog.conf # env=!dontlog zusaetzlich bei Log-Anweisung noetig: # CustomLog .../access.log vhost_combined env=!dontlog # Loggen des Zugriffs auf Monit-Token verhindern SetEnvIf Request_URI "^\/monit_xxx\/token$" dontlog
# vi /etc/apache2/ports.conf
[...]
Listen 81.169.132.218:80
[...]
Listen 81.169.132.218:443
# /etc/init.d/apache2 start # ps -Naf | grep apache2 root [...] /usr/sbin/apache2 -k start www-data [...] /usr/sbin/apache2 -k start [...] # less /var/log/apache2/error.log [notice] Apache/2.2.3 configured -- resuming normal operations
/var/www/<vhost>.# a2dissite default
# mkdir /var/www/disorganized
# vi /etc/apache2/sites-available/disorganized
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@disorganized.de
ServerName disorganized.de
DocumentRoot /var/www/disorganized/
<Directory /var/www/disorganized/>
Order allow,deny
Allow from all
AllowOverride none
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.disorganized.de
Redirect permanent / http://disorganized.de/
</VirtualHost>
# a2ensite disorganized # /etc/init.d/apache2 force-reload
/var/www/disorganized/index.html anlegen, sonst gibt es beim zweiten curl-Aufruf den Fehlercode 403):$ curl -I http://www.disorganized.de/ HTTP/1.1 301 Moved Permanently Location: http://disorganized.de/ [...] $ curl -I http://disorganized.de/ HTTP/1.1 200 OK [...]
# a2enmod ssl
# mkdir /etc/apache2/ssl # chmod 700 /etc/apache2/ssl # cp disorganized.de.cert disorganized.de.key /etc/apache2/ssl # chown root:root /etc/apache2/ssl/* # chmod 444 /etc/apache2/ssl/disorganized.de.cert # chmod 400 /etc/apache2/ssl/disorganized.de.key
# vi /etc/apache2/conf.d/ssl.conf <IfModule mod_ssl.c> # http://www.securityfocus.com/infocus/1820 SSLProtocol -all +TLSv1 +SSLv3 SSLCipherSuite HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+MEDIUM </IfModule>
# vi /etc/apache2/sites-available/disorganized
[...]
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/nilpferd.disorganized.de.cert
SSLCertificateKeyFile /etc/apache2/ssl/nilpferd.disorganized.de.key
ServerAdmin webmaster@disorganized.de
ServerName nilpferd.disorganized.de
DocumentRoot /var/www/disorganized/
<Directory /var/www/disorganized/>
Order allow,deny
Allow from all
AllowOverride none
</Directory>
</VirtualHost>
# /etc/init.d/apache2 force-reload # less /var/log/apache2/error.log [...] [info] Loading certificate & private key of SSL-aware server [...] [info] Configuring server for SSL protocol [info] Server: Apache/2.2.3, Interface: mod_ssl/2.2.3, Library: OpenSSL/0.9.8c [notice] Apache/2.2.3 configured -- resuming normal operations
.crt wird gleich der richtige Content-Type verwendet, der einfachen Import per Browser erlaubt, sonst muss eine „AddType“-Zeile zur Apache-Konfiguration hinzugefügt werden):# openssl x509 -inform PEM -outform DER -in ca-cert.pem -out ca-cert.crt # cp ca-cert.crt /var/www/disorganized/downloads