• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst] Apache2 sendet nur Quelltext an Browser

Ja, ich habe schon gesucht aber noch keine Lösung gefunden.

Beschreibung meines Problems:
Aufgrund eines Festplattencrashes musste ich mein openSUSE 11.4 neu installieren. Damit also auch den Apache.
Glücklicherweise konnte ich den "etc"-Ordner von der alten Festplatte retten.
Ich habe inzwischen alle Funktionen meines Servers wieder hergestellt bzw. installiert und einige Config-Dateien (ddclient, crontab usw.) von der alten Konfiguration zurück kopiert.
So auch den Ordner "apache2".

Nun wird mein Server im Internet gefunden und der Apache sendet auch was:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
	<head>
		<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
		<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
		<title>BrotBräuner's Homepage</title>
		<link rel="shortcut icon" type="image/x-icon" href="Bilder/Icon.ico">
	</head>
	<frameset rows=140,* frameborder="0" framespacing="0">
		<frameset cols=220,*>
			<frame name="Logoframe" src="Logo001.html">
			<frame name="Registerframe" src="RegisterSteffen.html">
		</frameset>
		<frameset cols=220,*>
			<frame name="Menueframe" src="Steffen/MenueStart.html">
    			<frame name="Hauptframe" src="Steffen/HauptStart.html">
    		</frameset>
	</frameset>
</html>
Ja, ich weis. Frames und so..........
Aber das ist nicht mein Problem!

Eigentlich sollte dort meine Webseite angezeigt werden.
Wenn ich meine index.html über den Dolphin öffne, wird sie korrekt angezeigt. Bei Eingabe meiner lokalen IP oder der Web-Adresse kommt nur der Quellcode.
Ich habe ausschließlich HTML, kein PHP oder MySQL.
Das Alte System war ebenfalls openSUSE 11.4 mit der gleichen Software.

Was braucht Ihr noch für Configs/Ausgaben?
 

panamajo

Guru
BrotBraeuner schrieb:
Wenn ich meine index.html über den Dolphin öffne, wird sie korrekt angezeigt. Bei Eingabe meiner lokalen IP oder der Web-Adresse kommt nur der Quellcode.
Ich habe ausschließlich HTML, kein PHP oder MySQL.
Das Alte System war ebenfalls openSUSE 11.4 mit der gleichen Software.

Was braucht Ihr noch für Configs/Ausgaben?
Vmtl. wird der Content-Type Header mit text/plain belegt statt text/html, dann rendert der Browser den HTML Code nicht sondern stellt ihn 1:1 dar.
Überprüfen mit z.B.
Code:
curl -I http://localhost/
 
OP
B

BrotBraeuner

Member
Ja, das ist der Fall.
Dieser Parameter wird doch in der httpd.conf geändert, oder?
Wenn ja:
Interessanterweise habe ich dies ebenfalls von meinem "alten" Server übernommen, der allerdings sauber gearbeitet hat.
Ich habe diesen Eintrag auch schon editiert, jedoch ohne Erfolg.

Noch was Seltsames:
Ein anderer virtueller Host (http://sg-blaichach.selfip.org) wird richtig dargestellt.

Ich probiers trotzdem nochmal

Weitere Phänomene:
Ich habe beide Seiten mit je zwei VHosts eingetragen. einmal mit www. davor und einmal wie oben ohne dieses Präfix.
Ohne Präfix funktioniert "sg-blaichach" tadellos. Bei "brotbrauner" kommt nur Quelltext.
Mit Präfix kommt nur "Seiten-Ladefehler"

Noch was:
Ich habe mal testweise den Apache komplett deinstalliert. Das Ergebnis liess mich beinahe vom Glauben abfallen. Meine Webseiten waren exakt wie zuvor erreichbar??????????
 
OP
B

BrotBraeuner

Member
Ich dreh' langsam durch:
Habe gerade den "brotbraeuner" im IE eingegeben und die Seite hat funktioniert!!!!
Danach nochmals im Firefox und wieder kam der Quelltext. Also gesamte Chronik gelösch (und zwar WIRKLICH alles). Aber ohne Erfolg!
Ach ja: die "sg-blaichach" jetzt ebenso.
 
OP
B

BrotBraeuner

Member
OK, ich habe jetzt ganz offiziell die Schnauze voll:

Ich habe die Einstellung nochmals vorgenommen. Erstes Ergtebnis: Fehlschlag
Dann habe ich nochmal die gesamte Chronik des Firefox gelöscht: FUNKTIONIERT!!!!!!!

Ich bin jetzt mit den Nerven am Ende und geh' jetzt erst mal meine Kinder wickeln!!!

Ich hoffe nur, dass das jetzt kein temporärer Erfolg ist.
Ausserdem wundert es mich, dass meine alte Installation mit "text/plain" korrekt gearbeitet hat.

Vielen Dank für die Hilfe. Manchmal braucht man einfach jemanden, mit dem man über das Problem reden kann.
 

panamajo

Guru
BrotBraeuner schrieb:
Interessanterweise habe ich dies ebenfalls von meinem "alten" Server übernommen, der allerdings sauber gearbeitet hat.
Ich habe diesen Eintrag auch schon editiert, jedoch ohne Erfolg.
Welchen Eintrag hat du wo wie geändert?

Bei openSUSE gibt es seit geraumer Zeit keine monolithische httpd.conf mehr sondern mehrere .conf Dateien und mindestens eine für jeden VHost. In diesem Zusammenhang sind mod_mime-defaults.conf und magic in /etc/apache2 interessant.

BrotBraeuner schrieb:
Mit Präfix kommt nur "Seiten-Ladefehler"
Was steht in /var/log/apache2/error_log
 
OP
B

BrotBraeuner

Member
Den Eintrag mit text/plain auf text/html in der httpd.conf
Die Ausgabe von curl ergab dann auch text/html

error_log:
Code:
[Sat Jun 18 10:21:07 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 10:29:41 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 10:29:42 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 10:30:28 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 10:30:28 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 11:20:11 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 11:20:12 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 11:36:35 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 11:36:35 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 11:38:56 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 11:39:35 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 12:09:50 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 12:09:50 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 12:54:07 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 12:54:08 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 13:37:01 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 13:37:59 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 15:05:02 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 15:05:03 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 15:17:18 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 15:19:20 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 15:27:40 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 15:27:41 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 15:30:29 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 15:30:29 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 15:31:25 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 15:31:26 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 15:34:21 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 15:34:21 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:07:23 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:08:33 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:12:31 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:12:32 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:14:16 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:14:17 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:28:05 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:28:05 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:30:56 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:30:57 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:35:36 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:35:37 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:38:19 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:38:20 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:39:35 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:39:36 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:39:41 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:39:41 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:39:45 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:39:45 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:40:37 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:40:37 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:40:41 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:40:42 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
[Sat Jun 18 16:40:51 2011] [notice] caught SIGTERM, shutting down
[Sat Jun 18 16:40:52 2011] [notice] Apache/2.2.17 (Linux/SUSE) configured -- resuming normal operations
Die "Fehlermeldungen" stammen alle von
"rcapache2 restart"
 
OP
B

BrotBraeuner

Member
Es tut mir leid, dass ich den Thread nochmal auf "ungelöst" setzen muss, aber ich habe festgestellt, dass JPG-Bilder meiner Seiten ebenfalls nur als "Quelltext" angezeigt werden.
Um etwas genauer zu sein:
Ich habe Thumbnails auf meinen Seiten ebenfalls als JPG angebracht, die per Link auf die Originalversion der Bilder verweisen.
Die Thumbnails werden korrekt dargestellt. Beim klick auf die Thumbnails kommt aber nur noch ein wilder Zeichensalat.
Ich glaube, dass es wohl an den Mime-Types hängt.
Aber was mich am meisten verwundert: Dieser Effekt tritt bei mir nur unter Firefox und Konqueror auf. Der Internet Explorer zeigt meine Seite richtig an.
 
OP
B

BrotBraeuner

Member
OK, ich habs:
Es lag alles an den MIME-Types!
Ich habe die einstellung der Default MIME-Type in httpd.conf wieder auf "text/plain" gestellt.
In der Datei "mod_mime-defaults.conf" habe ich dann die Ergänzungen für die unterschiedlichen Dateiformate ergänzt:
Code:
AddType text/html .html .htm
AddType image/gif .gif .GIF
AddType image/ief .ief
AddType image/jpeg .jpeg .jpg .jpe .JPG
AddType image/tiff .tiff .tif
Das reicht for mich mal.
Ich habe aber auch eine größere Liste gefunden:
Code:
AddType text/html .html .htm
AddType text/plain .txt
AddType text/richtext .rtx
AddType text/tab-separated-values .tsv
AddType text/x-setext .etx
AddType text/x-server-parsed-html .shtml .sht
AddType application/macbinhex-40 .hqx
AddType application/netalivelink .nel
AddType application/netalive .net
AddType application/news-message-id
AddType application/news-transmission
AddType application/octet-stream .bin .exe
AddType application/oda .oda
AddType application/pdf .pdf
AddType application/postscript .ai .eps .ps
AddType application/remote-printing
AddType application/rtf .rtf
AddType application/slate
AddType application/zip .zip
AddType application/x-mif .mif
AddType application/wita
AddType application/wordperfect5.1
AddType application/x-csh .csh
AddType application/x-dvi .dvi
AddType application/x-hdf .hdf
AddType application/x-latex .latex
AddType application/x-netcdf .nc .cdf
AddType application/x-sh .sh
AddType application/x-tcl .tcl
AddType application/x-tex .tex
AddType application/x-texinfo .texinfo .texi
AddType application/x-troff .t .tr .roff
AddType application/x-troff-man .man
AddType application/x-troff-me .me
AddType application/x-troff-ms .ms
AddType application/x-wais-source .src
AddType application/x-bcpio .bcpio
AddType application/x-cpio .cpio
AddType application/x-gtar .gtar
AddType application/x-shar .shar
AddType application/x-sv4cpio .sv4cpio
AddType application/x-sv4crc .sv4crc
AddType application/x-tar .tar
AddType application/x-ustar .ustar
AddType application/x-director .dcr
AddType application/x-director .dir
AddType application/x-director .dxr
AddType application/x-onlive .sds
AddType application/x-httpd-cgi .cgi
AddType image/gif .gif .GIF
AddType image/ief .ief
AddType image/jpeg .jpeg .jpg .jpe .JPG
AddType image/tiff .tiff .tif
AddType image/x-cmu-raster .ras
AddType image/x-portable-anymap .pnm
AddType image/x-portable-bitmap .pbm
AddType image/x-portable-graymap .pgm
AddType image/x-portable-pixmap .ppm
AddType image/x-rgb .rgb
AddType image/x-xbitmap .xbm
AddType image/x-xpixmap .xpm
AddType image/x-xwindowdump .xwd
AddType audio/basic .au .snd
AddType audio/x-aiff .aif .aiff .aifc
AddType audio/x-wav .wav
AddType audio/x-pn-realaudio .ram
AddType audio/x-midi .mid
AddType video/mpeg .mpeg .mpg .mpe
AddType video/quicktime .qt .mov
AddType video/x-msvideo .avi
AddType video/x-sgi-movie .movie
AddType message/external-body
AddType message/news
AddType message/partial
AddType message/rfc822
AddType multipart/alternative
AddType multipart/appledouble
AddType multipart/digest
AddType multipart/mixed
AddType multipart/parallel
AddType x-world/x-vrml .wrl

Mich wundert an der ganzen Geschichte nur, dass das jetzt erst aufgetreten ist. Oder es ist mir früher nicht aufgefallen.
Jetzt schließ ich den Fall aber wirklich als "gelöst" ab.

Danke fürs zuhören.
 

panamajo

Guru
BrotBraeuner schrieb:
Es lag alles an den MIME-Types!
Ich habe die einstellung der Default MIME-Type in httpd.conf wieder auf "text/plain" gestellt.
In der Datei "mod_mime-defaults.conf" habe ich dann die Ergänzungen für die unterschiedlichen Dateiformate ergänzt:
Code:
AddType text/html .html .htm
AddType image/gif .gif .GIF
AddType image/ief .ief
AddType image/jpeg .jpeg .jpg .jpe .JPG
AddType image/tiff .tiff .tif

Mich wundert an der ganzen Geschichte nur, dass das jetzt erst aufgetreten ist. Oder es ist mir früher nicht aufgefallen.

Das Mapping der Dateinamen auf den MIME Type sollte eigentlich unnötig sein. In der httpd.conf einer aktuellen openSUSE steht z.B.:
Code:
# associate MIME types with filename extensions
TypesConfig /etc/apache2/mime.types
DefaultType text/plain
Include /etc/apache2/mod_mime-defaults.conf

Durch TypesConfig wird das an libmagic delegiert, was den Vorteil hat dass auch falsche Namen korrekt gemappt werden. Vllt. fehlt dieser Eintrag bei dir?
 
Oben