Apache-2.4

子域解析到另一個域

  • March 7, 2018

我想要子域sarkastrunova.clevermarketing.cz

如果您現在將其添加到瀏覽器,它會解析為horsetransport.cz同一網路伺服器上的另一個虛擬主機。我不知道為什麼。

A 和 AAAA 的 DNS 記錄sarkastrunova.clevermarketing.cz解析到我的伺服器。

子域的配置文件

# 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>

現在解析到的域的配置文件

# 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>

子域無法解析的原因一定有一些明顯的錯誤。任何幫助表示讚賞

您的VirtualHost配置本身似乎很好。您的配置中是否包含所有配置文件?您可以使用sudo apache2ctl -S. 修改配置後是否重新載入了 Apache ( sudo systemtcl reload apache2)?

引用自:https://serverfault.com/questions/900452