Ik probeer op mijn Ubuntu server meerdere sites te hosten achter een enkel WAN IP. Ik heb echter het probleem dat ik vanaf de verschillende subdomeinen elke keer op de eerste virtual host terecht kom, en niet op de tweede virtual host.
WAN IP heeft poorten 80 en 443 geforward naar mijn Linux bakkie. Hierop draait Ubuntu 20.04.2 en Apache 2.4.41
Oorspronkelijk doel was om deze server Nextcloud (nc.damianweb.nl) te laten draaien, dat doet ie dan nu ook prima. Ik wil er nu dus een website naast gaan draaien, die op public.damianweb.nl moet gaan draaien. Ik heb hiervoor een tweede conf file aangemaakt, en deze netjes geplaatst in sites-available, en daarna geactiveerd (a2ensite public.conf). Uiteraard Apache herstart. Ook de server is voor de zekerheid herstart.
De sites-available config files zien er nu zo uit:
public.conf
nextcloud.conf
nextcloud-le-ssl.conf
Ik heb in mijn ports.conf onderstaand gezet n.a.v. wat zoekwerk, echter is dat volgens mij al depricated:
Overige info:
Probleem is dat zowel nc.damianweb.nl als public.damianweb.nl naar de NextCloud instance gaan, al krijg ik op public.damianweb.nl wel een foutmelding van NextCloud omdat het geen trusted_domain is om NextCloud te benaderen.
Ik ben niet zo'n Apache Guru dus ik weet ff niet waar het nu in zit. Als jullie meer info nodig hebben hoor ik het uiteraard graag!
WAN IP heeft poorten 80 en 443 geforward naar mijn Linux bakkie. Hierop draait Ubuntu 20.04.2 en Apache 2.4.41
Oorspronkelijk doel was om deze server Nextcloud (nc.damianweb.nl) te laten draaien, dat doet ie dan nu ook prima. Ik wil er nu dus een website naast gaan draaien, die op public.damianweb.nl moet gaan draaien. Ik heb hiervoor een tweede conf file aangemaakt, en deze netjes geplaatst in sites-available, en daarna geactiveerd (a2ensite public.conf). Uiteraard Apache herstart. Ook de server is voor de zekerheid herstart.
De sites-available config files zien er nu zo uit:
public.conf
code:
1
2
3
4
5
6
7
8
9
10
11
| <VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/public
ServerName damianweb.nl
ServerAlias public.damianweb.nl
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost> |
nextcloud.conf
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| <VirtualHost *:80>
DocumentRoot "/var/www/nextcloud"
ServerName damianweb.nl
ServerAlias nc.damianweb.nl
ErrorLog ${APACHE_LOG_DIR}/nextcloud.error
CustomLog ${APACHE_LOG_DIR}/nextcloud.access combined
<Directory /var/www/nextcloud/>
Require all granted
Options FollowSymlinks MultiViews
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
Satisfy Any
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =nc.damianweb.nl
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost> |
nextcloud-le-ssl.conf
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| <IfModule mod_ssl.c>
SSLStaplingCache shmcb:/var/run/apache2/stapling_cache(128000)
<VirtualHost *:443>
DocumentRoot "/var/www/nextcloud"
ServerName damianweb.nl
ServerAlias nc.damianweb.nl
ErrorLog ${APACHE_LOG_DIR}/nextcloud.error
CustomLog ${APACHE_LOG_DIR}/nextcloud.access combined
<Directory /var/www/nextcloud/>
Require all granted
Options FollowSymlinks MultiViews
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
Satisfy Any
</Directory>
SSLCertificateFile /etc/letsencrypt/live/nc.damianweb.nl/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nc.damianweb.nl/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLUseStapling on
Header always set Strict-Transport-Security "max-age=31536000"
</VirtualHost>
</IfModule> |
Ik heb in mijn ports.conf onderstaand gezet n.a.v. wat zoekwerk, echter is dat volgens mij al depricated:
code:
1
2
| NameVirtualHost *:80 NameVirtualHost *:443 |
Overige info:
code:
1
2
3
| root@nextcloud:/var/www/public# apachectl configtest AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/ports.conf:6 Syntax OK |
code:
1
2
3
4
5
6
7
8
9
10
11
| root@nextcloud:/var/www/public# apachectl -t -D DUMP_VHOSTS
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/ports.conf:6
VirtualHost configuration:
*:443 damianweb.nl (/etc/apache2/sites-enabled/nextcloud-le-ssl.conf:3)
*:80 is a NameVirtualHost
default server localhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost damianweb.nl (/etc/apache2/sites-enabled/nextcloud.conf:1)
alias nc.damianweb.nl
port 80 namevhost damianweb.nl (/etc/apache2/sites-enabled/public.conf:1)
alias public.damianweb.nl |
Probleem is dat zowel nc.damianweb.nl als public.damianweb.nl naar de NextCloud instance gaan, al krijg ik op public.damianweb.nl wel een foutmelding van NextCloud omdat het geen trusted_domain is om NextCloud te benaderen.
Ik ben niet zo'n Apache Guru dus ik weet ff niet waar het nu in zit. Als jullie meer info nodig hebben hoor ik het uiteraard graag!
Ieri ero quiete, perché oggi sarò la tempesta