PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Nach Neuinstallation (Mint 17): Apache Virtual Hosts?



X_FISH
08.06.14, 18:30
Ich habe gestern eine neue Festplatte ausgepackt und mich daher die letzten 24 Stunden mit dem Einrichten von Windows 7 und Linux Mint 17 beschäftigen »dürfen«.

Soweit läuft auch alles, nur kann ich meine alte (4 Jahre) Konfiguration vom Apache 2 nicht weiterverwenden. Der Grund: Virtual Hosts.

Ich habe eine Testumgebung, welche ich via localhost nutze. Mittels virtual hosts sind meine Website-Projekte getrennt:

foo.localhost
bar.localhost
etc.localhost

Die bisherige Konfiguration (in /etc/apache2/sites-enabled) funktioniert leider nicht mehr. Ich finde nur nicht wieso.

Meine Vermutung:


By default, Ubuntu does not allow access through the web browser to any file apart of those located in /var/www, public_html directories (when enabled) and /usr/share (for web applications). If your site is using a web document root located elsewhere (such as in /srv) you may need to whitelist your document root directory in /etc/apache2/apache2.conf.

The default Ubuntu document root is /var/www/html. You can make your own virtual hosts under /var/www. This is different to previous releases which provides better security out of the box.

Meine Website-Projekte liegen nicht in /var/www -> war bisher beim alten Mint kein Problem.

Was muss ich in der apache2.conf deaktivieren (oder aktivieren) damit es wieder so ist wie bisher? Der Server hängt nicht im Netz, daher ist das mit der Sicherheit zweitrangig.

edit

Ergänzend: Bisher war's ein Apache 2.2 auf dem die Testumgebung lief. Installiert wurde mit Linux Mint ein Apache 2.4.

Konkretes Problem: Fehler 403 beim Aufruf der Seite (virtual host). Ausreichende Zugriffsrechte (755) auf das Verzeichnis sind gesetzt.

Grüße, Martin

X_FISH
08.06.14, 20:33
Update mit Lösung

Mehrere Ursachen führten zu den Problemen. Vielleicht braucht ja noch jemand demänchst Hilfe:


<Directory /home/foo/html/bar/>
Options FollowSymLinks
# AllowOverride All
Require all granted
</Directory>

Wenn das AllowOverride All von der alten Konfiguration nicht gelöscht/auskommentiert wird -> Error 403 forbidden.

Das Require all granted führt beim Apache 2.2 zu einem Error 500, beim 2.4 ist es zwingend notwendig, ansonsten -> Error 403 forbidden.

Hier habe ich eine Anleitung gefunden, welche die Änderungen von 2.2 auf 2.4 bezüglich der virtual hosts behandelt:

-> https://library.linode.com/web-servers/apache/2.2-2.4-upgrade
_____

Das nächste Problem: PHP geht nicht mehr. Auch hier wieder: Auf dem 2.2er Apache alles kein Problem... Aber das liegt dann wohl auch (mit) an meiner Schlampigkeit...

Die Ursache: <? ?> in den PHP-Skripten. Beim »short open tag« gibt es nun aber Probleme... <?php ?> sollte man verwenden...

-> http://stackoverflow.com/questions/20586671/lamp-stacks-php-not-working-ubuntu-13-10-apache-2-4-6


; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = On

Sollte eigentlich per default auf On stehen... Aber bei Linux Mint 17 ist es auf Off...
_____

Grüße, Martin