Kapitel 07: virtuelle Hosts

This commit is contained in:
Sven Velt 2024-10-15 14:40:20 +02:00
parent 8e39b99920
commit 65ca0877fd
7 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,75 @@
##### Kapitel 7 - Virtuelle Hosts
### Vorbereitung
<Directory /usr/local/apache2/htdocs-*>
Require all granted
</Directory>
### IP-based VHost
<VirtualHost 172.31.31.101:80>
DocumentRoot /usr/local/apache2/htdocs-ipbased.sv
ServerName ipbased.sv
CustomLog logs/ipbased-access.log combined
ErrorLog logs/ipbased-error.log
#Redirect / https://ipbased.sv/
</VirtualHost>
### Name-based VHost
<VirtualHost 172.31.31.102:80>
DocumentRoot /var/www/empty
ServerName 172.31.31.102
ErrorLog logs/102-error.log
</VirtualHost>
<VirtualHost 172.31.31.102:80 *:8002>
DocumentRoot /usr/local/apache2/htdocs-firma1.sv
ServerName firma1.sv
ServerAlias *.firma1.sv
CustomLog logs/firma1-access.log combined
ErrorLog logs/firma1-error.log
</VirtualHost>
<VirtualHost 172.31.31.102:80 *:8002>
DocumentRoot /usr/local/apache2/htdocs-firma2.sv
ServerName firma2.sv
ServerAlias *.firma2.sv
CustomLog logs/firma2-access.log combined
ErrorLog logs/firma2-error.log
</VirtualHost>
### Massen-Hosting
LoadModule vhost_alias_module modules/mod_vhost_alias.so
UseCanonicalName off
LogFormat "%V %h %l %u %t \"%r\" %>s %b" vcommon
LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vcombined
<VirtualHost 172.31.31.103:80>
VirtualDocumentRoot /usr/local/apache2/htdocs-mass/%-2.0.%-1.0
CustomLog logs/masshosting-access.log vcombined
ErrorLog logs/masshosting-error.log
</VirtualHost>
##### Weiteres
### VHost auf 127.0.0.1:8001
Listen 127.0.0.1:8001
<VirtualHost 127.0.0.1:8001>
DocumentRoot /usr/local/apache2/htdocs-8001
CustomLog logs/8001-access.log combined
ErrorLog logs/8001-error.log
</VirtualHost>
### Name-base VHosts zusätzlich auf Port 8002
Listen *:8002
#<VirtualHost 172.31.31.102:80 *:8002>
# [...]
#</VirtualHost>

1
htdocs-8001/index.html Normal file
View file

@ -0,0 +1 @@
<h1>Svens WebServer auf 8001</h1>

View file

@ -0,0 +1 @@
<h1>Svens erster Name-based WebServer</h1>

View file

@ -0,0 +1 @@
<h1>Svens zweiter Name-based WebServer</h1>

View file

@ -0,0 +1 @@
<h1>Svens IP-based WebServer</h1>

View file

@ -0,0 +1 @@
<h1>Svens erster Massenhosting-WebServer</h1>

View file

@ -0,0 +1 @@
<h1>Svens zweiter Massenhosting-WebServer</h1>