Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
lpi2:apache [2015/07/09 11:00] ingo_wichmann [Konfiguration] |
lpi2:apache [2022/12/22 10:11] (aktuell) |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Apache ====== | ====== Apache ====== | ||
===== Benötigte Pakete ===== | ===== Benötigte Pakete ===== | ||
- | Fedora, CentOS: | + | CentOS (ab 5): |
httpd | httpd | ||
- | openSuSE: | + | openSuSE, Debian (ab 3.1), Ubuntu: |
- | apache2 apache2-prefork | + | apache2 |
- | Debian (ab 3.1): | + | ===== Webseite anlegen ===== |
- | apache2 apache2-mpm-prefork | + | |
- | + | ||
- | ===== Konfiguration ===== | + | |
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/test.html'' : ( ab Debian 5.0 ) | ||
<code html> | <code html> | ||
<html> | <html> | ||
Zeile 32: | Zeile 28: | ||
</code> | </code> | ||
- | ''/var/www/html/test.html'' : ( ab Debian 8.0 ) | + | ===== Dienst starten ===== |
- | <code html> | + | CentOS: |
- | <html> | + | service httpd start |
- | <head> | + | |
- | <title>Hello World!</title> | + | SuSE: |
- | </head> | + | service apache start |
- | <body> | + | |
- | Hello World | + | Debian/Ubuntu: |
- | </body> | + | service apache2 start |
- | </html> | + | |
- | </code> | + | |
===== Testen ===== | ===== Testen ===== | ||
- | === netcat === | + | === netcat / nc === |
- | netcat -v 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 | ||
Zeile 62: | Zeile 61: | ||
=== 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 | ||
Zeile 69: | Zeile 69: | ||
===== cgi Skript ===== | ===== cgi Skript ===== | ||
==== Konfiguration ==== | ==== Konfiguration ==== | ||
- | Debian (ab 8.0): | + | Debian (ab 8.0), Ubuntu (ab 16.04): |
a2enmod cgi | a2enmod cgi | ||
==== Skript ==== | ==== Skript ==== | ||
- | ''/usr/lib/cgi-bin/test'' : ( Debian 6.0 ) | + | ''/usr/lib/cgi-bin/test'' : ( Debian 6.0, Ubuntu 16.04 ) |
''/srv/www/cgi-bin/test'' : ( openSuSE 12.1 ) | ''/srv/www/cgi-bin/test'' : ( openSuSE 12.1 ) | ||
- | ''/var/www/cgi-bin/test'' : ( Centos 6 ) | + | ''/var/www/cgi-bin/test'' : ( Centos ab 6 ) |
<code bash> | <code bash> | ||
Zeile 93: | Zeile 93: | ||
echo "</html>" | echo "</html>" | ||
</code> | </code> | ||
- | Debian: | + | Debian, Ubuntu: |
chmod +x /usr/lib/cgi-bin/test | chmod +x /usr/lib/cgi-bin/test | ||
SuSE: | SuSE: | ||
Zeile 109: | Zeile 109: | ||
)) | )) | ||
- | ====== IPv6 abschalten ====== | ||
- | |||
- | ''/etc/apache2/ports.conf'' : ( Debian 4.0 ) | ||
- | <file> | ||
- | Listen 0.0.0.0:80 | ||
- | </file> | ||
====== Dokumentation ====== | ====== Dokumentation ====== |