Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
lpi2:apache [2016/11/25 13:35] ingo_wichmann [Skript] |
lpi2:apache [2022/12/22 10:11] |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== Apache ====== | ||
- | ===== Benötigte Pakete ===== | ||
- | Fedora, CentOS: | ||
- | httpd | ||
- | |||
- | openSuSE, Debian (ab 3.1), Ubuntu: | ||
- | apache2 | ||
- | |||
- | ===== Webseite anlegen ===== | ||
- | Im einfachsten Fall | ||
- | * startet man den Webserver | ||
- | * hinterlegt eine Webseite | ||
- | * und greift darauf zu | ||
- | |||
- | ''/var/www/html/test.html'': ( CentOS ) | ||
- | |||
- | ''/srv/www/htdocs/test.html'': ( SuSE 10.0 ) | ||
- | |||
- | ''/var/www/test.html'' : ( ab Debian 5.0 ) | ||
- | |||
- | ''/var/www/html/test.html'' : ( ab Debian 8.0, Ubuntu 16.04 ) | ||
- | <code html> | ||
- | <html> | ||
- | <head> | ||
- | <title>Hello World!</title> | ||
- | </head> | ||
- | <body> | ||
- | Hello World | ||
- | </body> | ||
- | </html> | ||
- | </code> | ||
- | |||
- | ===== Testen ===== | ||
- | === netcat / nc === | ||
- | Debian, OpenSuSE: | ||
- | netcat -v localhost 80 | ||
- | |||
- | CentOS (( Paket: nmap-ncat )) | ||
- | nc -v localhost 80 | ||
- | |||
- | GET http://localhost/test.html HTTP/1.1 | ||
- | Host: localhost | ||
- | | ||
- | === telnet === | ||
- | telnet localhost 80 | ||
- | GET http://localhost/test.html HTTP/1.1 | ||
- | Host: localhost | ||
- | | ||
- | === wget === | ||
- | wget -O - http://localhost/test.html | ||
- | |||
- | === curl === | ||
- | curl http://localhost/test.html | ||
- | |||
- | === ab === | ||
- | ab -n 1000 -c 100 http://localhost/test.html | ||
- | |||
- | == openSuSE (ab 11.4) == | ||
- | ab2 -n 1000 -c 100 http://localhost/test.html | ||
- | |||
- | ===== 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 | ||
- | )) | ||
- | |||
- | ====== IPv6 abschalten ====== | ||
- | |||
- | ''/etc/apache2/ports.conf'' : ( Debian 4.0 ) | ||
- | <file> | ||
- | Listen 0.0.0.0:80 | ||
- | </file> | ||
- | |||
- | ====== Dokumentation ====== | ||
- | * [[ 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://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 ]] | ||