Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


lpi2:apache-virtual-hosts

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

lpi2:apache-virtual-hosts [2018/06/14 12:17]
127.0.0.1 Externe Bearbeitung
lpi2:apache-virtual-hosts [2024/04/25 13:41]
Zeile 1: Zeile 1:
-====== Namebased Virtual Hosts ====== 
-Vorraussetzung:​ [[apache]], [[bind]] und [[dns]] 
- 
-===== Namen im DNS eintragen ===== 
-Die Namen aller Virtual Hosts müssen im DNS eingetragen sein, fehlende wie unter [[bind]] gezeigt hinzufügen 
-==== Namensauflösung testen ==== 
-  getent hosts notebook14.linuxhotel.de 
-  getent hosts iw.linuxhotel.de 
- 
-===== SuSE ===== 
-==== HTML-Dateien ablegen ==== 
-openSuSE ab 10.2: 
-<file html /​srv/​www/​htdocs/​test.html>​ 
-<​html>​ 
-  <​head>​ 
-    <​title>​Default Host notebook34!</​title>​ 
-  </​head>​ 
-  <​body>​ 
-    <​h1>​Default Host notebook34</​h1>​ 
-    Link zu <a href="​http://​iw.linuxhotel.de/​test.html">​Virtual Host</​a>​ 
-  </​body>​ 
-</​html>​ 
-</​file>​ 
- 
-  mkdir -p /​srv/​www/​iw.linuxhotel.de/​{cgi-bin,​htdocs} 
- 
-openSuSE ab 10.2: 
-<file html /​srv/​www/​iw.linuxhotel.de/​htdocs/​test.html>​ 
-<​html>​ 
-  <​head>​ 
-    <​title>​Virtual Host iw!</​title>​ 
-  </​head>​ 
-  <​body>​ 
-    <​h1>​Virtual Host iw</​h1>​ 
-    Link zu <a href="​http://​notebook34.linuxhotel.de/​test.html">​Default Host</​a>​ 
-  </​body>​ 
-</​html>​ 
-</​file>​ 
- 
-==== Apache Konfiguration ==== 
-openSuSE bis 12.3: 
-<file txt /​etc/​apache2/​listen.conf>​ 
-NameVirtualHost * 
-</​file>​ 
- 
-openSuSE ab 10.2: 
-<file txt /​etc/​apache2/​conf.d/​default_vhost.conf>​ 
-<​VirtualHost *> 
-</​VirtualHost>​ 
-</​file>​ 
- 
-openSuSE ab 42.1: 
-<file txt /​etc/​apache2/​vhosts.d/​iw.linuxhotel.de.conf>​ 
-<​VirtualHost *> 
-  ServerName iw.linuxhotel.de 
-  DocumentRoot /​srv/​www/​iw.linuxhotel.de/​htdocs 
- 
-  <​Directory "/​srv/​www/​iw.linuxhotel.de/​htdocs">​ 
-    Require all granted 
-  </​Directory>​ 
-</​VirtualHost>​ 
-</​file>​ 
- 
-==== Konfigdateien überprüfen ==== 
-  apache2ctl configtest 
-Vhosts anzeigen: 
-  apache2ctl -S 
- 
-==== Konfiguration neu laden ==== 
-  apache2ctl graceful 
- 
-===== CentOS 7 ===== 
-==== HTML-Dateien ablegen ==== 
-<file html /​var/​www/​html/​test.html>​ 
-<​html>​ 
-  <​head>​ 
-    <​title>​Default Host notebook34!</​title>​ 
-  </​head>​ 
-  <​body>​ 
-    <​h1>​Default Host notebook34</​h1>​ 
-    <a href="​http://​iw.linuxhotel.de/​test.html">​Virtual Host</​a>​ 
-  </​body>​ 
-</​html>​ 
-</​file>​ 
- 
-  mkdir -p /​var/​www/​iw.linuxhotel.de/​{cgi-bin,​html} 
- 
-<file html /​var/​www/​iw.linuxhotel.de/​html/​test.html>​ 
-<​html>​ 
-  <​head>​ 
-    <​title>​Virtual Host iw!</​title>​ 
-  </​head>​ 
-  <​body>​ 
-    Virtual Host iw<​br/>​ 
-    <a href="​http://​notebook34.linuxhotel.de/​test.html">​Default Host</​a>​ 
-  </​body>​ 
-</​html>​ 
-</​file>​ 
- 
-==== Apache Konfiguration ==== 
-<file txt /​etc/​httpd/​conf.d/​vhosts.conf>​ 
-<​VirtualHost *:80> 
-</​VirtualHost>​ 
- 
-Include vhosts.d/​*.conf 
-</​file>​ 
- 
-  mkdir /​etc/​httpd/​vhosts.d 
- 
-<file txt /​etc/​httpd/​vhosts.d/​iw.linuxhotel.de.conf>​ 
-<​VirtualHost *:80> 
-  ServerName iw.linuxhotel.de 
-  DocumentRoot /​var/​www/​iw.linuxhotel.de/​html 
- 
-  <​Directory "/​var/​www/​iw.linuxhotel.de/​html">​ 
-    Require all granted 
-  </​Directory>​ 
-</​VirtualHost>​ 
-</​file>​ 
- 
-==== Konfigdateien überprüfen ==== 
-  apachectl configtest 
-Vhosts anzeigen: 
-  httpd -S 
- 
-==== Konfiguration neu laden ==== 
-  apachectl graceful 
- 
-===== Debian / Ubuntu ===== 
-==== HTML-Dateien ablegen ==== 
-<file html /​var/​www/​html/​test.html>​ 
-<​html>​ 
-  <​head>​ 
-    <​title>​Default Host notebook34!</​title>​ 
-  </​head>​ 
-  <​body>​ 
-    <​h1>​Default Host notebook34</​h1>​ 
-    Link zu <a href="​http://​iw.linuxhotel.de/​test.html">​Virtual Host</​a>​ 
-  </​body>​ 
-</​html>​ 
-</​file>​ 
- 
-  mkdir -p /​srv/​iw.linuxhotel.de/​{html,​cgi-bin} 
-ab Debian 5.0: 
-<file html /​srv/​iw.linuxhotel.de/​html/​test.html>​ 
-<​html>​ 
-  <​head>​ 
-    <​title>​Virtual Host iw!</​title>​ 
-  </​head>​ 
-  <​body>​ 
-    <​h1>​Virtual Host iw</​h1>​ 
-    Link zu <a href="​http://​notebook34.linuxhotel.de/​test.html">​Default Host</​a>​ 
-  </​body>​ 
-</​html>​ 
-</​file>​ 
- 
-==== Apache Konfiguration ==== 
-Debian 5 - 7: //apache Version 2.2// 
-<file txt /​etc/​apache2/​sites-available/​iw.linuxhotel.de>​ 
-<​VirtualHost *:80> 
-  ServerName iw.linuxhotel.de 
-  DocumentRoot /​srv/​iw.linuxhotel.de/​html 
- 
-  <​Directory "/​srv/​iw.linuxhotel.de/​html">​ 
-    Order allow,deny 
-    Allow from all 
-  </​Directory>​ 
-</​VirtualHost>​ 
-</​file>​ 
- 
-Debian ab 8, Ubuntu 16.04: //apache Version 2.4// 
-<file txt /​etc/​apache2/​sites-available/​iw.linuxhotel.de.conf>​ 
-<​VirtualHost *:80> 
-  ServerName iw.linuxhotel.de 
-  DocumentRoot /​srv/​iw.linuxhotel.de/​html 
- 
-  <​Directory "/​srv/​iw.linuxhotel.de/​html">​ 
-    Require all granted 
-  </​Directory>​ 
-</​VirtualHost>​ 
-</​file>​ 
-  a2ensite iw.linuxhotel.de 
- 
-==== Konfigdateien überprüfen ==== 
-  apache2ctl configtest 
-Vhosts anzeigen: 
-  apache2ctl -S 
- 
-==== Konfiguration neu laden ==== 
-  apache2ctl graceful 
- 
-===== Virtual-Host testen ===== 
-=== netcat === 
-(( ''​-C''​ habe ich zum ersten Mal unter Debian 8 gebraucht )) 
-  netcat -Cv localhost 80 
-  GET /test.html HTTP/1.1 
-  host: iw.linuxhotel.de 
- 
-=== wget === 
-  wget -nv -O - --header="​Host:​ iw.linuxhotel.de"​ http://​localhost/​test.html 
- 
-=== ab === 
-  ab -H 'Host: iw.linuxhotel.de'​ http://​localhost/​test.html 
- 
  
lpi2/apache-virtual-hosts.txt · Zuletzt geändert: 2024/04/25 13:41 (Externe Bearbeitung)