Ich habe auf einem Debian 11 (frisch installiert) den Apache2 Webserver installiert.
Funktioniert auch soweit und ich kann von anderen Rechnern im Netz auch diese "It Works"-Willkommensseite aufrufen. (http://192.168.41.11/)
Ich will 2 (und später evtl. mehr) Seiten auf diesem Server haben.
Diese sind nur dafür bestimmt dass ich sie von meinen Rechnern innerhalb meines LAN's aufrufen kann.
Meine Einrichtung zum Testen sieht nun folgendermaßen aus:
Ich habe im Verzeichnis /var/www/html/ zwei Ordner mit jeweils einer index.html Datei drin (halt mit anderem Text auf der Seite zum unterscheiden).
Dann im Verzeichnis /etc/apache2/sites-available sind zwei .conf Dateien drin wo halt die VirtualHost definiert sind.
Dann habe ich die Befehle a2dissite 000-default, a2ensite eins.conf, a2ensite zwei.conf und systemctl reload apache2 ausgeführt.
Danach apache2ctl configtest wo die Ausgabe dann "Syntax OK" war. Danach habe ich noch die /etc/hosts Datei angepasst.
Sollte doch eigentlich alles gehen, oder?
Aber wenn ich von einem anderem Rechner im Browser http://192.168.41.11/ eingebe erscheint nur die erste Seite.
Bei http://192.168.41.11/eins oder http://192.168.41.11/zwei erscheint im Browser die Meldung "The requested URL was not found on this server".
Was habe ich falsch gemacht?
tail -f /var/log/apache2/error.log, tail -f /var/log/apache2/access.log und tail -f /var/log/apache2/other_vhosts_access.log geben nichts aus?
/var/www/html
Code: Alles auswählen
root@lamp:~# ls -l /var/www/html/
drwxrwxr-x 2 www-data www-data 4096 Feb 25 00:20 eins
-rwxr-xr-x 1 root root 10701 Feb 21 17:20 index.html
drwxrwxr-x 2 www-data www-data 4096 Feb 25 00:20 zwei
root@lamp:~# ls -l /var/www/html/eins/
-rwxrwxr-x 1 www-data www-data 347 Feb 25 00:20 index.html
root@lamp:~# ls -l /var/www/html/zwei/
-rwxrwxr-x 1 www-data www-data 348 Feb 25 00:20 index.html
/etc/apache2
Code: Alles auswählen
root@lamp:/etc/apache2# ls -l
-rw-r--r-- 1 root root 7224 Jun 9 2022 apache2.conf
drwxr-xr-x 2 root root 4096 Feb 21 17:20 conf-available
drwxr-xr-x 2 root root 4096 Feb 21 17:20 conf-enabled
-rw-r--r-- 1 root root 1782 Jun 9 2022 envvars
-rw-r--r-- 1 root root 31063 Jun 9 2022 magic
drwxr-xr-x 2 root root 12288 Feb 21 17:26 mods-available
drwxr-xr-x 2 root root 4096 Feb 21 17:26 mods-enabled
-rw-r--r-- 1 root root 320 Jun 9 2022 ports.conf
drwxr-xr-x 2 root root 4096 Feb 25 00:22 sites-available
drwxr-xr-x 2 root root 4096 Feb 25 00:22 sites-enabled
root@lamp:/etc/apache2# ls -l sites-available/
-rw-r--r-- 1 root root 1332 Jun 9 2022 000-default.conf
-rw-r--r-- 1 root root 6338 Jun 9 2022 default-ssl.conf
-rw-r--r-- 1 root root 215 Feb 25 00:15 eins.conf
-rw-r--r-- 1 root root 215 Feb 25 00:16 zwei.conf
root@lamp:/etc/apache2# ls -l sites-enabled/
lrwxrwxrwx 1 root root 28 Feb 25 00:22 eins.conf -> ../sites-available/eins.conf
lrwxrwxrwx 1 root root 28 Feb 25 00:22 zwei.conf -> ../sites-available/zwei.conf
/etc/apache2/sites-available/eins.conf (bei zwei.conf ist einfach jedes "eins" durch "zwei" ersetzt)
Code: Alles auswählen
root@lamp:/etc/apache2/sites-available# cat eins.conf
<VirtualHost *:80>
ServerAdmin webmaster@eins
ServerName eins
DocumentRoot /var/www/html/eins/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
/etc/hosts
Code: Alles auswählen
root@lamp:~# cat /etc/hosts
# War schon vorher da
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
# War schon vorher da
# --- BEGIN PVE ---
192.168.41.11 lamp.pi lamp
# --- END PVE ---
# Selber per Hand angelegt
192.168.41.11 eins
192.168.41.11 zwei