Apache HTTP (Linux)
Installation
sudo apt-get install apache2 apache2-doc sudo apt-get install php5
Optional Benutzer zur, von Apache genutzten, Gruppe www-data hinzufügen:
sudo usermod -aG www-data <user name>
Konfiguration
Um die Warnung bezüglich Domainname zu unterdrücken, in der Datei /etc/apache2/apache2.conf am Ende folgende Zeile hinzufügen:
ServerName <domain name>
conf-available
Eine *.conf-Datei anlegen:
sudo touch /etc/apache2/conf-available/<conf name>.conf
Beispiel-Datei anhand der Seite phpMyAdmin:
Alias /phpmyadmin "/var/www/phpmyadmin/"
<Directory "/var/www/phpmyadmin">
Options +FollowSymLinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/phpmyadmin
SetEnv HTTP_HOME /var/www/phpmyadmin
</Directory>
Konfiguration aktivieren:
cd /etc/apache2/conf-available/ sudo a2enconf <conf name>.conf sudo service apache2 reload
sites-available
Port 80 auf Port 443 weiterleiten
<VirtualHost *:80>
ServerName <subdomain>.<domain>
ServerAlias <subdomain>.<domain>
Redirect / https://<subdomain>.<domain>
</VirtualHost>
Beispielkonfiguration für eine verschlüsselte Seite
<VirtualHost *:443>
ServerName <subdomain>.<domain>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/<subdomain>-apache.cert
SSLCertificateKeyFile /etc/ssl/private/apache.key
# Pfad zu den Webinhalten
DocumentRoot /var/www/<subdomain>
ErrorLog ${APACHE_LOG_DIR}/<subdomain>.<domain>-error.log
CustomLog ${APACHE_LOG_DIR}/<subdomain>.<domain>-access.log combined
</VirtualHost>
Konfiguration aktivieren
cd /etc/apache2/sites-available/ sudo a2ensite <conf name>.conf sudo service apache2 reload
Zurück zu Ubuntu