|
|
|
# Installation virtueller Hosts (Apache2)
|
|
|
|
|
|
|
|
Es wird von einer noch nicht geänderten Standardinstallation von »apache2«
|
|
|
|
unter »openSUSE« ausgegangen. Der Test erfolgte mit »openSUSE Leap 42.2«. Der
|
|
|
|
Zugriff auf die neu eingerichteten virtuellen Hosts soll nur über
|
|
|
|
unterschiedlich Portadressen (hier 81 und 82) erfolgen.
|
|
|
|
|
|
|
|
Folgende Konfigurationen müssen durchgeführt werden:
|
|
|
|
|
|
|
|
1. Anlegen der Konfigurationsdatei für einen virtuellen Host in
|
|
|
|
`/etc/apache2/vhosts.d/`.
|
|
|
|
```
|
|
|
|
<VirtualHost *:81>
|
|
|
|
DocumentRoot /srv/www/vhosts/foo
|
|
|
|
HostnameLookups Off
|
|
|
|
UseCanonicalName Off
|
|
|
|
ServerSignature On
|
|
|
|
Include /etc/apache2/conf.d/*.conf
|
|
|
|
ScriptAlias /cgi-bin/ "/srv/www/vhosts/foo/cgi-bin/"
|
|
|
|
<Directory "/srv/www/vhosts/foo/cgi-bin">
|
|
|
|
AllowOverride None
|
|
|
|
Options +ExecCGI -Includes
|
|
|
|
<IfModule !mod_access_compat.c>
|
|
|
|
Require all granted
|
|
|
|
</IfModule>
|
|
|
|
<IfModule mod_access_compat.c>
|
|
|
|
Order allow,deny
|
|
|
|
Allow from all
|
|
|
|
</IfModule>
|
|
|
|
</Directory>
|
|
|
|
<IfModule mod_userdir.c>
|
|
|
|
UserDir public_html
|
|
|
|
Include /etc/apache2/mod_userdir.conf
|
|
|
|
</IfModule>
|
|
|
|
|
|
|
|
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
|
|
|
|
|
|
|
|
<Directory "/srv/www/vhosts/foo">
|
|
|
|
Options Indexes FollowSymLinks
|
|
|
|
AllowOverride None
|
|
|
|
<IfModule !mod_access_compat.c>
|
|
|
|
Require all granted
|
|
|
|
</IfModule>
|
|
|
|
<IfModule mod_access_compat.c>
|
|
|
|
Order allow,deny
|
|
|
|
Allow from all
|
|
|
|
</IfModule>
|
|
|
|
</Directory>
|
|
|
|
</VirtualHost>
|
|
|
|
```
|
|
|
|
1. Erzeugen des zugehörigen Verzeichnisses (»DocumentRoot«)
|
|
|
|
```
|
|
|
|
mkdir -p /srv/www/vhosts/foo
|
|
|
|
chown -R wwwrun.www /srv/www/vhosts/
|
|
|
|
```
|
|
|
|
1. Ergänzen von `/etc/apache2/listen.conf`
|
|
|
|
```
|
|
|
|
...
|
|
|
|
Listen 80
|
|
|
|
Listen 81
|
|
|
|
Listen 82
|
|
|
|
...
|
|
|
|
NameVirtualHost *:81
|
|
|
|
NameVirtualHost *:82
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
Spielen Sicherheitsaspekte eine besondere Rolle, muss zur Bedeutung der
|
|
|
|
verwendeten sowie von weiteren Einträgen nachgelesen und ggf. Ergänzungen
|
|
|
|
vorgenommen werden.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|