WAMP服务器上的子域无法正常工作

时间:2018-03-06 00:40:20

标签: apache virtualhost wampserver

我的WAMP服务器配置存在重大问题。我尝试过许多网站上列出的许多配置都无济于事。我试图通过https://forums.centmc.tk访问目录/论坛。但是,在前往https://forums.centmc.tk时,它几乎立即说" forums.centmc.tk的服务器IP地址无法找到。" https://centmc.tk工作正常,301从https://centmc.tk/forums重定向到https://forums.centmc.tk也是如此。我无法弄清楚子域名为何无法运作。

我知道我的httpd-vhosts.conf文件存在问题,所以这就是:

# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "c:/wamp64/www"
<Directory "c:/wamp64/www/">
  Options +Indexes +Includes +FollowSymLinks +MultiViews
  AllowOverride All
  Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:443>
DocumentRoot   c:/wamp64/www
ServerName     centmc.tk
SSLEngine      on
SSLCertificateFile c:/wamp64/bin/apache/apache2.4.27/conf/centmc.tk.crt
SSLCertificateKeyFile c:/wamp64/bin/apache/apache2.4.27/conf/centmc.tk.key
Redirect 301 /forums https://forums.centmc.tk
Redirect 301 /forum https://forums.centmc.tk
<Directory "c:/wamp64/www/">
  Options +Indexes +Includes +FollowSymLinks +MultiViews
  AllowOverride All
  Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:443>
ServerName centmc.tk
ServerAlias forums.centmc.tk
VirtualDocumentRoot "c:/wamp/www/forums"
ErrorLog "c:/wamp64/bin/apache/apache2.4.27/logs/errors.log"
<Directory "c:/wamp/www/forums">
  Options +Indexes +Includes +FollowSymLinks +MultiViews
  AllowOverride All
  Require all granted
</Directory>
</VirtualHost>

提前感谢您的帮助!对不起,顶部有相当大的文字砖。

1 个答案:

答案 0 :(得分:0)

卢卡斯。

听起来像DNS问题。如果您在网络上运行DNS服务器,则需要为“论坛”子域添加“A”记录。像这样:

; example.com [448369]
$TTL 86400
@   IN  SOA ns1.linode.com. admin.example.com. 2013062147 14400 14400 1209600 86400
@           MX  10  mail.example.com.
@           A   ###.###.###.###
mail        A   ###.###.###.###
www         A   <put your server IP here>
forums      A   <put your forums server IP here>

如果您使用的是公共DNS服务器(例如8.8.8.8,4.4.4.4,或者只是您的默认ISP的DNS服务器......那么您需要在您的域名注册的任何地方添加CNAME记录。(GoDaddy)例如)。这是GoDaddy上如何做到这一点的链接:https://www.godaddy.com/help/add-a-subdomain-that-points-to-an-ip-address-4080

我希望有所帮助。