Apache HTTP (Linux): Unterschied zwischen den Versionen
		
		
		
		
		
		Zur Navigation springen
		Zur Suche springen
		
				
		
		
	
| Zeile 113: | Zeile 113: | ||
| === You don't have permission to access ''<url>'' on this server.=== | === You don't have permission to access ''<url>'' on this server.=== | ||
| Das kann daran liegen, dass sich die Folder-Konfiguration von ''Apache 2.2'' auf ''Apache 2.4'' geändert hat. | |||
| Konfiguration in ''Apache 2.2'': | |||
| <pre> | <pre> | ||
| Order allow,deny | <Directory> | ||
| Allow from all |   ... | ||
|   Order allow,deny | |||
|   Allow from all | |||
|   ... | |||
| </Directory> | |||
| </pre> | </pre> | ||
| Konfiguration in ''Apache 2.4'': | |||
| <pre> | <pre> | ||
| Require all granted | </Directory> | ||
|   ... | |||
|   Require all granted | |||
|   ... | |||
| </Directory> | |||
| </pre> | </pre> | ||
| Zurück zu [[Ubuntu]] | Zurück zu [[Ubuntu]] | ||
Version vom 21. Mai 2016, 10:39 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.
Das kann daran liegen, dass sich die Folder-Konfiguration von Apache 2.2 auf Apache 2.4 geändert hat.
Konfiguration in Apache 2.2:
<Directory> ... Order allow,deny Allow from all ... </Directory>
Konfiguration in Apache 2.4:
</Directory> ... Require all granted ... </Directory>
Zurück zu Ubuntu