Apache HTTP (Linux): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 107: | Zeile 107: | ||
sudo a2ensite <conf name>.conf | sudo a2ensite <conf name>.conf | ||
sudo service apache2 reload | sudo service apache2 reload | ||
</pre> | |||
== Fehlermeldungen == | |||
=== You don't have permission to access ''<url>'' on this server.=== | |||
<pre> | |||
Order allow,deny | |||
Allow from all | |||
</pre> | |||
<pre> | |||
Require all granted | |||
</pre> | </pre> | ||
Zurück zu [[Ubuntu]] | Zurück zu [[Ubuntu]] | ||
Version vom 21. Mai 2016, 10:35 Uhr
Installation
sudo apt-get install apache2 apache2-doc
sudo apt-get install php5
bzw.
sudo apt-get install php
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.crt
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
Fehlermeldungen
You don't have permission to access <url> on this server.
Order allow,deny Allow from all
Require all granted
Zurück zu Ubuntu