I'm having a bit of trouble getting a subdomain activated on my local dev server. The server's name is janemba and I access it by going to http://janemba. I'd like to be able to have domain.janemba, but I can't seem to get it to work.

This is the VirtualHost I have:

<VirtualHost *:80>
        ServerName domain.janemba
        ServerAdmin admin@janemba
        DocumentRoot /var/www/domain

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

I've also tried making it domain.example.com and setting my hosts file to make example.com point to my local dev server. Example.com loads fine, but subdomains will not.

  • 1
    ubuntuforums.org/showthread.php?t=3407 - Check this. The system should be able to resolve the domain.janemba first, then Apache will handle it.
    – Rolice
    Aug 16 '14 at 11:42
  • The host shouldn't be the issue here. I guess I should mention that I'm trying to access this from a separate computer on the same network.
    – Nathan
    Aug 16 '14 at 12:13
  • 1
    Then certainly you have to add such record to the other machine I suppose. You are not creating hostname there, you mark the domain to be resolved to the host IP or name.
    – Rolice
    Aug 16 '14 at 13:56
  • The host file is set up on the other machine, as stated in the question (albeit not very clearly).
    – Nathan
    Aug 16 '14 at 17:02
  • As I read it you have set it up on the local machine, but not visitor's one. You can ping and traceroute to check for the results.
    – Rolice
    Aug 17 '14 at 8:26

I think it's a DNS problem, you can test this in dos / cmd prompt by doing ping domain.janemba and see what you get as compared to ping janemba

Do you have DNS set up? I think you need to either have an internal private dNS server with zone files including records for the subdomains you want, or you need to enter those subdomains into your client computer's hosts file.

update: just noticed you are using your 'hosts' file - just add a new line for each subdomain record.

Once your computer is looking to the correct ip address of the server, the subdomains should work.

  • Tried doing this but it doesn't point to the web root of the subdomain. I can go to the subdomain URL, but I just see the main root.
    – Nathan
    Aug 16 '14 at 17:03

Maybe you have forgotten to enable Virtual Hosts? Do you have:

NameVirtualHost *:80

somewhere in your httpd.conf or included conf files?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.