0

I have got two 2 subdomains for the domain example.com. Which is remote.example.com and archive.example.com.

Apache is taking requests for all subdomains leading always to the same virtual host.

The Server is listening to port 8082.

This is my virtual hosts file /etc/apache2/sites-available. archive.example.com-conf:

NameVirtualHost archive.example.com:8082

<VirtualHost *:8082>
    ServerAdmin webmaster@example.com
    ServerName archive.example.com
    DocumentRoot /var/www/archive
</VirtualHost>

When I enter remote.example.com in the browsers address line it os being routed to the same virtual host as archive.example.com.

Output of apache2ctl -S:

AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/archive.example.com.conf:1
VirtualHost configuration:
*:8082                 archive.example.com (/etc/apache2/sites-enabled/archive.example.com.conf:3)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
Jenny D
  • 27,358
  • 21
  • 74
  • 110
  • 1
    The default VirtualHost in Apache will be used to handle queries for all (sub-)domains and ip-addresses that are not explicitly configured in other VirtualHost entries. The first VirtualHost in Apache is the default. You don't show a separate VirtualHost for remote.xyz.com , thus the content for archive.xyz.com is displayed – HBruijn May 08 '19 at 13:14
  • Thanks for your advice. @HBruijn: I just want to get a response to archive.xyz.com, remote.xyz.com should not respond at all. – Markus Schenkenberg May 08 '19 at 13:22
  • AFAIK make a different VirtualHost the default and configure that to always return a an error response https://serverfault.com/q/231438/37681 – HBruijn May 08 '19 at 13:27
  • And you can remove the `NameVirtualHost` as it [doesn't have any effect](https://httpd.apache.org/docs/2.4/upgrading.html#misc) in Apache 2.4. – Freddy May 08 '19 at 14:13
  • Have you modified your `hosts`file? – Anuga May 08 '19 at 16:55

0 Answers0