Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
fortgeschrittene:apache [2011/08/08 09:14] ingo_wichmann [Dokumentation] |
fortgeschrittene:apache [2025/05/02 11:42] (aktuell) |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Apache ====== | ====== 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 16: | 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 30: | Zeile 26: | ||
</body> | </body> | ||
</html> | </html> | ||
- | </file> | + | </code> |
+ | |||
+ | ===== Dienst starten ===== | ||
+ | CentOS: | ||
+ | service httpd start | ||
+ | |||
+ | SuSE: | ||
+ | systemctl start apache2.service | ||
+ | |||
+ | Debian/Ubuntu: | ||
+ | service apache2 start | ||
===== Testen ===== | ===== Testen ===== | ||
- | === netcat === | + | === netcat / nc === |
- | netcat localhost 80 | + | Debian, OpenSuSE: |
+ | netcat -Cv localhost 80 | ||
+ | |||
+ | CentOS (( Paket: nmap-ncat )) | ||
+ | nc -Cv localhost 80 | ||
GET http://localhost/test.html HTTP/1.1 | GET http://localhost/test.html HTTP/1.1 | ||
Host: localhost | Host: localhost | ||
+ | | ||
=== telnet === | === telnet === | ||
telnet localhost 80 | telnet localhost 80 | ||
GET http://localhost/test.html HTTP/1.1 | GET http://localhost/test.html HTTP/1.1 | ||
Host: localhost | Host: localhost | ||
+ | | ||
=== wget === | === wget === | ||
wget -O - http://localhost/test.html | wget -O - http://localhost/test.html | ||
+ | |||
+ | === curl === | ||
+ | curl http://localhost/test.html | ||
=== ab === | === ab === | ||
+ | (( bei Debian im Paket ''apache2-utils'' )) | ||
ab -n 1000 -c 100 http://localhost/test.html | ab -n 1000 -c 100 http://localhost/test.html | ||
- | ====== IPv6 abschalten ====== | ||
- | ''/etc/apache2/ports.conf'' : ( Debian 4.0 ) | + | == openSuSE (ab 11.4) == |
- | <file> | + | ab2 -n 1000 -c 100 http://localhost/test.html |
- | Listen 0.0.0.0:80 | + | |
- | </file> | + | ===== cgi Skript ===== |
+ | ==== Konfiguration ==== | ||
+ | Debian (ab 8.0), Ubuntu (ab 16.04): | ||
+ | a2enmod cgi | ||
+ | |||
+ | ==== Skript ==== | ||
+ | |||
+ | ''/usr/lib/cgi-bin/test'' : ( Debian 6.0, Ubuntu 16.04 ) | ||
+ | |||
+ | ''/srv/www/cgi-bin/test'' : ( openSuSE 12.1 ) | ||
+ | |||
+ | ''/var/www/cgi-bin/test'' : ( Centos ab 6 ) | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | echo -e 'Content-type: text/html\r\n' | ||
+ | echo | ||
+ | echo "<html>" | ||
+ | echo "<head><title>cgi Beispiel</title></head>" | ||
+ | echo "<body>" | ||
+ | |||
+ | ps ax | sed 's/$/<br>/' | ||
+ | |||
+ | echo "</body>" | ||
+ | echo "</html>" | ||
+ | </code> | ||
+ | Debian, Ubuntu: | ||
+ | chmod +x /usr/lib/cgi-bin/test | ||
+ | SuSE: | ||
+ | chmod +x /srv/www/cgi-bin/test | ||
+ | CentOS: | ||
+ | chmod +x /var/www/cgi-bin/test | ||
+ | |||
+ | ''http://localhost/cgi-bin/test'' im Browser aufrufen | ||
+ | |||
+ | (( Vorsicht, hier werden Daten ungeprüft an den Browser geschickt! Rufen Sie mal das cgi auf während folgender Prozess läuft: | ||
+ | cat - '<script>alert("Uups")</script>' | ||
+ | |||
+ | Funktioniert unter CentOS nur, wenn SELinux abgeschaltet ist: | ||
+ | setenforce Permissive | ||
+ | )) | ||
====== Dokumentation ====== | ====== Dokumentation ====== |