Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


fortgeschrittene:apache

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

Nächste Überarbeitung
Vorherige Überarbeitung
fortgeschrittene:apache [2010/11/26 13:34]
127.0.0.1 Externe Bearbeitung
fortgeschrittene:apache [2025/05/02 11:42] (aktuell)
Zeile 1: Zeile 1:
-====== Apache ​Out of the Box ====== +====== Apache ======
 ===== Benötigte Pakete ===== ===== Benötigte Pakete =====
-Fedora:+CentOS (ab 5):
   httpd   httpd
  
-SuSE: +openSuSE, ​Debian ​(ab 3.1), Ubuntu:  
-  apache2 apache2-prefork +  apache2
- +
-Debian ab 3.1: +
-  apache2 ​apache2-mpm-prefork+
  
-===== Konfiguration ​=====+===== Webseite anlegen ​=====
 Im einfachsten Fall  Im einfachsten Fall 
   * startet man den Webserver   * startet man den Webserver
Zeile 17: Zeile 13:
   * und greift darauf zu   * und greift darauf zu
  
-''/​var/​www/​html/​test.html'':​ ( CentOS )+''/​var/​www/​html/​test.html'':​ ( CentOS ​ab 7, Debian ab 8, Ubuntu ab 16.04 )
  
-''/​srv/​www/​htdocs/​test.html'':​ ( SuSE 10.0 )+''/​srv/​www/​htdocs/​test.html'':​ ( ab SuSE 10.0 )
  
-''/​var/​www/​index.html''​ : ( Debian 5.0 ) +<code html>
-<file>+
 <​html>​ <​html>​
   <​head>​   <​head>​
Zeile 31: Zeile 26:
   </​body>​   </​body>​
 </​html>​ </​html>​
-</file>+</code>
  
-===== Testen ​===== +===== Dienst starten ​===== 
-  ​telnet localhost 80 +CentOS
-  GET http://​localhost/​test.html HTTP/1.1 +  ​service httpd start
-  ​Host: localhost+
  
-====== Namebased Virtual Hosts ====== +SuSE: 
-Vorraussetzung[[bind]] und [[dns]]+  systemctl start apache2.service ​
  
-Achtungin der Apache-Konfiguration ist die Reihenfolge wichtig. ​+Debian/​Ubuntu: 
 +  service apache2 start
  
-===== Namen im DNS eintragen ​===== +===== Testen ​===== 
-Die Namen aller Virtual Hosts müssen im DNS eingetragen sein, fehlende wie unter [[bind]] gezeigt hinzufügen +=== netcat / nc === 
-==== Namensauflösung testen ==== +Debian, OpenSuSE: 
-  ​getent hosts notebook14.linuxhotel.de +  ​netcat -Cv localhost 80
-  ​getent hosts iw.linuxhotel.de+
  
-===== SuSE ===== +CentOS ​(( Paket: nmap-ncat ​)
-''/​etc/​apache2/​listen.conf''​ : SuSE 10.2 )+  nc -Cv localhost 80
  
-<​file>​ +  GET http://​localhost/​test.html HTTP/1.1 
-NameVirtualHost * +  Host: localhost 
-</file>+   
 +=== telnet === 
 +  telnet localhost 80 
 +  GET http://​localhost/​test.html HTTP/1.1 
 +  Host: localhost 
 +   
 +=== wget === 
 +  wget -O - http://​localhost/test.html
  
-''​/etc/apache2/conf.d/​default_vhost.conf''​ : ( SuSE 10.2 )+=== curl === 
 +  curl http://localhost/test.html
  
-<​file>​ +=== ab === 
-<​VirtualHost *> +(( bei Debian im Paket ''​apache2-utils''​ )) 
-</VirtualHost>​ +  ab -n 1000 -c 100 http://localhost/​test.html
-</file>+
  
-''​/etc/apache2/vhosts.d/​iw.linuxhotel.de.conf''​ : ( SuSE 10.2 )+== openSuSE (ab 11.4) == 
 +  ab2 -n 1000 -c 100 http://localhost/test.html
  
-<​file>​ +===== cgi Skript ===== 
-<​VirtualHost *> +==== Konfiguration ==== 
-  ​ServerName iw.linuxhotel.de +Debian (ab 8.0), Ubuntu (ab 16.04): 
-  ​DocumentRoot /​srv/​www/​iw.linuxhotel.de/​htdocs+  ​a2enmod cgi
  
-  <​Directory "/​srv/​www/​iw.linuxhotel.de/​htdocs">​ +==== Skript ====
-    Order allow,​deny +
-    Allow from all +
-  </​Directory>​ +
-</​VirtualHost>​ +
-</​file>​+
  
-==== Configdateien überprüfen ==== +''/​usr/​lib/​cgi-bin/​test''​ : ( Debian 6.0, Ubuntu 16.04 )
-  apache2ctl configtest +
-  apache2ctl ​-t+
  
-==== HTML-Dateien ablegen ==== +''/​srv/​www/​cgi-bin/​test''​ : ( openSuSE 12.)
-''/​srv/​www/​htdocs/test.html''​ : ( SuSE 10.)+
  
-<​file>​ +''​/var/www/cgi-bin/test''​ : ( Centos ab 6 )
-<​html>​ +
-  <​head>​ +
-    <​title>​Default Host notebook34!<​/title> +
-  </head> +
-  <​body>​ +
-    Default Host notebook34 +
-  </body> +
-</html> +
-</​file>​+
  
-  mkdir /srv/www/iw.linuxhotel.de/​{cgi-bin,​htdocs}+<code bash> 
 +#!/bin/bash 
 +echo -e '​Content-type:​ text/html\r\n'​ 
 +echo 
 +echo "<​html>"​ 
 +echo "<​head><​title>​cgi Beispiel</​title></​head>"​ 
 +echo "<​body>"​
  
-''/srv/www/iw.linuxhotel.de/​htdocs/​test.html'​' ​: ( SuSE 10.2 )+ps ax | sed 's/$/<br>/'
  
-<file+echo "</body>" 
-<​html>​ +echo "</html>" 
-  <​head>​ +</code> 
-    <​title>​Virtual Host iw!</title+Debian, Ubuntu: ​ 
-  ​</head> +  ​chmod +x /usr/lib/​cgi-bin/​test 
-  ​<​body>​ +SuSE:  
-    ​Virtual Host iw +  ​chmod +x /​srv/​www/​cgi-bin/​test 
-  ​</body> +CentOS: 
-</html> +  ​chmod +x /var/www/cgi-bin/​test
-</file>+
  
-===== CentOS 5 ===== +''​http://localhost/cgi-bin/test'' ​im Browser aufrufen
-''/​etc/httpd/conf/httpd.conf''​: ( Centos 5 )+
  
-<file> +(( Vorsicht, hier werden Daten ungeprüft an den Browser geschickt! Rufen Sie mal das cgi auf während folgender Prozess läuft: 
-ServerAdmin root@notebook14.linuxhotel.de +  cat - '<script>alert("​Uups"​)<​/script>'​
-ServerName notebook14.linuxhotel.de +
-DocumentRoot ​/var/​www/​html+
  
-<​Directory "/​var/​www/​html">​ +Funktioniert unter CentOS nurwenn SELinux abgeschaltet ist
-  Order allow,deny +  ​setenforce Permissive 
-  Allow from all +))
-</​Directory>​ +
- +
-ErrorLog logs/​error_log +
-CustomLog logs/​access_log combined +
-NameVirtualHost * +
- +
-<​VirtualHost *:80> +
-</​VirtualHost>​ +
- +
-Include vhosts.d/​*.conf +
-</​file>​ +
- +
-  ​mkdir vhosts.d +
- +
-''/​etc/​httpd/​vhosts.d/​iw.linuxhotel.de.conf''​ : ( Centos 5 ) +
- +
-<​file>​ +
-<​VirtualHost *:80> +
-  ServerName iw.linuxhotel.de +
-  DocumentRoot /​var/​www/​iw.linuxhotel.de/​html +
- +
-  <​Directory "/​var/​www/​iw.linuxhotel.de/​html">​ +
-    Order allow,​deny +
-    Allow from all +
-  </​Directory>​ +
-</​VirtualHost>​ +
-</​file>​ +
- +
-==== Configdateien überprüfen ==== +
-  apachectl configtest +
-  apachectl -S +
- +
-==== HTML-Dateien ablegen ==== +
-''/​var/​www/​html/​test.html''​ : ( Centos 5 ) +
- +
-<​file>​ +
-<​html>​ +
-  <​head>​ +
-    <​title>​Default Host notebook34!</​title>​ +
-  </​head>​ +
-  <​body>​ +
-    Default Host notebook34 +
-  </​body>​ +
-</​html>​ +
-</​file>​ +
- +
-  mkdir /​var/​www/​iw.linuxhotel.de/​{cgi-bin,​html} +
- +
-''/​var/​www/​iw.linuxhotel.de/​html/​test.html''​ : ( Centos 5 ) +
- +
-<​file>​ +
-<​html>​ +
-  <​head>​ +
-    <​title>​Virtual Host iw!</​title>​ +
-  </​head>​ +
-  <​body>​ +
-    Virtual Host iw +
-  </​body>​ +
-</​html>​ +
-</​file>​ +
- +
- +
- +
-===== Debian (5.0) ===== +
-''/​etc/​apache2/​sites-enabled/​000-default''​ : ( Debian 5.0 ) +
- +
-<​file>​ +
-<​VirtualHost *:80> +
-        ServerAdmin webmaster@notebook32.linuxhotel.de +
-        DocumentRoot /​var/​www/​notebook32.linuxhotel.de/​html +
- +
-        <​Directory /​var/​www/​notebook32.linuxhotel.de/​html>​ +
-                Order allow,​deny +
-                allow from all +
-        </​Directory>​ +
- +
-        ErrorLog /​var/​log/​apache2/​error.log +
-        CustomLog /​var/​log/​apache2/​access.log combined +
-</​VirtualHost>​ +
- +
-</​file>​ +
- +
-  mkdir -p /​var/​www/​notebook32.linuxhotel.de/​html +
- +
-''/​etc/​apache2/​sites-available/​iw.linuxhotel.de''​ : ( Debian 5.0 ) +
-<​file>​ +
-<​VirtualHost *:80> +
-  ServerName iw.linuxhotel.de +
-  DocumentRoot /​var/​www/​iw.linuxhotel.de/​html +
- +
-  <​Directory "/​var/​www/​iw.linuxhotel.de/​html">​ +
-    Order allow,​deny +
-    Allow from all +
-  </​Directory>​ +
-</​VirtualHost>​ +
-</​file>​ +
- +
-  mkdir -p /​var/​www/​iw.linuxhotel.de/​{html,​cgi-bin} +
-  a2ensite iw.linuxhotel.de +
- +
-==== Configdateien überprüfen ==== +
-  apache2ctl configtest +
- +
-==== HTML-Dateien ablegen ==== +
- +
-''/​var/​www/​notebook32.linuxhotel.de/​html/​index.html''​ : ( Debian 5.0 ) +
- +
-<​file>​ +
-<​html>​ +
-  <​head>​ +
-    <​title>​Default Host notebook32!</​title>​ +
-  </​head>​ +
-  <​body>​ +
-    Default Host notebook32 +
-  </​body>​ +
-</​html>​ +
-</​file>​ +
- +
-''/​var/​www/​iw.linuxhotel.de/​html/​index.html''​ : ( Debian 5.0 ) +
- +
-<​file>​ +
-<​html>​ +
-  <​head>​ +
-    <​title>​Virtual Host iw!</​title>​ +
-  </​head>​ +
-  <​body>​ +
-    Virtual Host iw +
-  </​body>​ +
-</​html>​ +
-</​file>​ +
- +
-===== Testen ===== +
-vhost-Konfiguration überprüfen:​ +
- +
-Debian: +
-  apache2ctl -S +
- +
-SuSE, Centos: +
-  httpd -S +
- +
-Apache neu starten: +
-  /​etc/​init.d/​apache2 restart +
- +
-oder Configtest und Reload in einem: graceful +
-SuSE 10.2, Debian 4.0: +
-  apache2ctl graceful +
- +
-Centos 5: +
-  apachectl graceful +
- +
-Virtual-Host testen: +
-  telnet localhost 80 +
-  GET /test.html http/1.1 +
-  host: iw.linuxhotel.de +
- +
-====== IPv6 abschalten ====== +
- +
-''/​etc/​apache2/​ports.conf''​ : ( Debian 4.0 ) +
-<​file>​ +
-Listen 0.0.0.0:​80 +
-</​file>​+
  
  
Zeile 287: Zeile 113:
   * [[ http://​www.novell.com/​de-de/​documentation/​opensuse103/​opensuse103_reference/​data/​sec_apache2_configuration.html | SuSE 10.3 ]]   * [[ http://​www.novell.com/​de-de/​documentation/​opensuse103/​opensuse103_reference/​data/​sec_apache2_configuration.html | SuSE 10.3 ]]
   * [[ http://​www.centos.org/​docs/​5/​html/​Deployment_Guide-en-US/​ch-httpd.html | Centos ]]   * [[ http://​www.centos.org/​docs/​5/​html/​Deployment_Guide-en-US/​ch-httpd.html | Centos ]]
-  * [[ http://​httpd.apache.org/​docs/​2.2 | Apache httpd ]]+  * [[ http://​httpd.apache.org/​docs/​2.2 | Apache httpd 2.2 ]] 
 + 
 +  * [[ http://​www.freiesmagazin.de/​mobil/​freiesMagazin-2011-08-bilder.html#​11_08_webzugriff | detaillierte Beschreibung eines Zugriffs auf eine Webseite ​]]
  
fortgeschrittene/apache.1290778475.txt.gz · Zuletzt geändert: 2011/04/07 07:25 (Externe Bearbeitung)