Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
fortgeschrittene:apache-virtual-hosts [2016/12/01 21:59] ingo_wichmann |
fortgeschrittene:apache-virtual-hosts [2024/04/25 13:41] (aktuell) sh [HTML-Dateien ablegen] |
||
---|---|---|---|
Zeile 3: | Zeile 3: | ||
===== Namen im DNS eintragen ===== | ===== Namen im DNS eintragen ===== | ||
- | Die Namen aller Virtual Hosts müssen im DNS eingetragen sein, fehlende wie unter [[bind]] gezeigt hinzufügen | + | Die Namen aller Virtual Hosts sind im DNS eingetragen, fehlende wie unter [[bind]] gezeigt hinzufügen |
==== Namensauflösung testen ==== | ==== Namensauflösung testen ==== | ||
getent hosts notebook14.linuxhotel.de | getent hosts notebook14.linuxhotel.de | ||
Zeile 84: | Zeile 84: | ||
</file> | </file> | ||
- | mkdir /var/www/iw.linuxhotel.de/{cgi-bin,html} | + | mkdir -p /var/www/iw.linuxhotel.de/{cgi-bin,html} |
<file html /var/www/iw.linuxhotel.de/html/test.html> | <file html /var/www/iw.linuxhotel.de/html/test.html> | ||
Zeile 114: | Zeile 114: | ||
<Directory "/var/www/iw.linuxhotel.de/html"> | <Directory "/var/www/iw.linuxhotel.de/html"> | ||
- | Order allow,deny | + | Require all granted |
- | Allow from all | + | |
</Directory> | </Directory> | ||
</VirtualHost> | </VirtualHost> | ||
Zeile 130: | Zeile 129: | ||
===== Debian / Ubuntu ===== | ===== Debian / Ubuntu ===== | ||
==== HTML-Dateien ablegen ==== | ==== HTML-Dateien ablegen ==== | ||
- | ab Debian 5.0: | + | <file html /var/www/html/test.html> |
- | <file html /srv/iw.linuxhotel.de/html/index.html> | + | |
<html> | <html> | ||
<head> | <head> | ||
- | <title>Virtual Host iw!</title> | + | <title>Default Host notebook34!</title> |
</head> | </head> | ||
<body> | <body> | ||
- | Virtual Host iw<br/> | + | <h1>Default Host notebook34</h1> |
- | <a href="http://notebook34.linuxhotel.de/test.html">Default Host</a> | + | Link zu <a href="http://iw.linuxhotel.de/test.html">Virtual Host</a> |
</body> | </body> | ||
</html> | </html> | ||
</file> | </file> | ||
- | ==== Apache Konfiguration ==== | + | mkdir -p /srv/iw.linuxhotel.de/{html,cgi-bin} |
- | Debian 5 - 7: //apache Version 2.2// | + | Debian (ab 8): |
- | <file txt /etc/apache2/sites-available/iw.linuxhotel.de> | + | <file html /srv/iw.linuxhotel.de/html/test.html> |
- | <VirtualHost *:80> | + | <html> |
- | ServerName iw.linuxhotel.de | + | <head> |
- | DocumentRoot /srv/iw.linuxhotel.de/html | + | <title>Virtual Host iw!</title> |
- | + | </head> | |
- | <Directory "/srv/iw.linuxhotel.de/html"> | + | <body> |
- | Order allow,deny | + | <h1>Virtual Host iw</h1> |
- | Allow from all | + | Link zu <a href="http://notebook34.linuxhotel.de/test.html">Default Host</a> |
- | </Directory> | + | </body> |
- | </VirtualHost> | + | </html> |
</file> | </file> | ||
- | Debian ab 8, Ubuntu 16.04: //apache Version 2.4// | + | ==== Apache Konfiguration ==== |
+ | Debian (ab 8), Ubuntu (ab 16.04): | ||
<file txt /etc/apache2/sites-available/iw.linuxhotel.de.conf> | <file txt /etc/apache2/sites-available/iw.linuxhotel.de.conf> | ||
<VirtualHost *:80> | <VirtualHost *:80> | ||
Zeile 168: | Zeile 167: | ||
</VirtualHost> | </VirtualHost> | ||
</file> | </file> | ||
- | mkdir -p /srv/iw.linuxhotel.de/{html,cgi-bin} | ||
a2ensite iw.linuxhotel.de | a2ensite iw.linuxhotel.de | ||
Zeile 180: | Zeile 178: | ||
===== Virtual-Host testen ===== | ===== Virtual-Host testen ===== | ||
- | === netcat / telnet === | + | === netcat === |
- | netcat -v localhost 80 | + | (( ''-C'' habe ich zum ersten Mal unter Debian 8 gebraucht )) |
- | GET /test.html http/1.1 | + | netcat -Cv localhost 80 |
+ | GET /test.html HTTP/1.1 | ||
host: iw.linuxhotel.de | host: iw.linuxhotel.de | ||