Search code examples
apachevirtualhostwampserver

Subdomain on WAMP Server Not Working


I'm having an important issue with my WAMP Server configuration. I've tried many configurations listed on many websites to no avail. I'm trying to make the directory /forums be accessible via https://forums.centmc.tk. However, upon travelling to https://forums.centmc.tk, it almost immediately says "forums.centmc.tk's server IP address could not be found." https://centmc.tk works fine, and so does the 301 redirect from https://centmc.tk/forums to https://forums.centmc.tk. I just can't figure out why the subdomain won't work.

I know it's an issue with my httpd-vhosts.conf file, so here's that:

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

Thanks for any help in advance! Sorry for the rather large text brick at the top.


Solution

  • Lucas.

    Sounds like a DNS problem. If you are running a DNS server on your network, you will need to add an "A" record for the "forums" subdomain. Something like this:

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

    If you're using public DNS servers (like 8.8.8.8, 4.4.4.4, or just your default ISP's DNS servers... you'll need to add a CNAME record to wherever your domain name is registered. (GoDaddy for example). Here's a link to how to do it on GoDaddy: https://www.godaddy.com/help/add-a-subdomain-that-points-to-an-ip-address-4080

    I hope that helps.