0

I would like to have subdomain sarkastrunova.clevermarketing.cz

If you add it to browser right now, it resolves to horsetransport.cz which is another Virtual Host on the same webserver. And I am clueless why.

DNS records of A and AAAA of sarkastrunova.clevermarketing.cz resolve to my server.

Config file for subdomain

# domain: sarkastrunova.clevermarketing.cz
# public: /var/www/html/sarkastrunova.clevermarketing.cz/public_html/
NameVirtualHost *:80
<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerName  sarkastrunova.clevermarketing.cz
  ServerAlias clevermarketing.cz
  ServerAdmin pavel@cleverstart.cz


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/sarkastrunova.clevermarketing.cz/public_html
  <Directory /var/www/html/sarkastrunova.clevermarketing.cz/public_html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
        php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -F info -finfo@clevermarketing.cz"
    </Directory>
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/html/sarkastrunova.clevermarketing.cz/log/error.log
  CustomLog /var/www/html/sarkastrunova.clevermarketing.cz/log/access.log combined
</VirtualHost>

Config file for domain to which it resolves now

# domain: horsetransport.cz
# public: /var/www/html/horsetransport.cz/public_html/

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin pavel@cleverstart.cz
  ServerName  horsetransport.cz
  ServerAlias www.horsetransport.cz

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/horsetransport.cz/public_html
  <Directory /var/www/html/horsetransport.cz/public_html>
        php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -F info -finfo@horsetransport.cz"
        AllowOverride All
    </Directory>
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/html/horsetransport.cz/log/error.log
  CustomLog /var/www/html/horsetransport.cz/log/access.log combined
</VirtualHost>

There must be some obvious error why the subdomain is not resolving. Any help is appreciated

  • Your terminology is wrong. The subdomain is resolving on the DNS, `sarkastrunova.clevermarketing.cz` gives 172.104.239.69 and 2a01:7e01::f03c:91ff:fe9c:600e for A and AAAA records. So traffic for it will hit these IPs and the webserver there must be configured for this subdomain. I have just tried and it does, without any HTTP redirection. So I do not understand what your question is in fact. Did you look at your logfiles? – Patrick Mevzek Mar 07 '18 at 14:27
  • @PatrickMevzek I tried to rearch logs as deeply as I could but I did not know where to look. Seems like that to some DNS it took bit more time than I expected to resolve – Pavel Janicek Mar 07 '18 at 16:05
  • Whatever problem you have from my query point and as of right now, it is not a DNS problem as things resolve. Your logfiles will typically be in `/var/log/apache` or `/var/log/httpd`, see the `AccessLog` and `ErrorLog` directives in the configuration they will show where logs are handled. – Patrick Mevzek Mar 07 '18 at 16:10

1 Answers1

2

Your VirtualHost configuration itself seems fine. Do you have all the configuration files included in your configuration? You can check using sudo apache2ctl -S. Have you reloaded Apache after modifying the configuration (sudo systemtcl reload apache2)?

Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129
  • I did all the things and hour later, without changing anything, the subdomain finally resolves. What the ... Thanks for your help! – Pavel Janicek Mar 07 '18 at 16:06
  • Is the subdomain something newly added? If so, it is usual that it may not appear immediately, depending on how you test things and how the DNS caches you use are polluted (specifically just prior of adding the record in the zone). – Patrick Mevzek Mar 07 '18 at 16:11