I manage a lot of projects on my personal development server. I just upgraded Apache and accidentally reset the configuration files in the process, so I thought this was a good opportunity to optimize my setup.
Before, I had one virtual host which pointed to a directory containing a bunch of project directories. That way I could just go to mydomain.com/MyProject
. This works okay, but has some problems with certain kinds of linking.
I would vastly prefer to automatically map myProjectOne.mydomain.com
to the myProjectOne
directory. (I assume this behavior will always be case-insensitive because I'm using a subdomain instead of a directory name.)
I found this question that seems to be the answer. But when I used this approach, I got a 404 error.
<VirtualHost *:80>
VirtualDocumentRoot /home/MyUsername/Projects/%0
ServerName mydomain.com
ServerAlias *.mydomain.com
</VirtualHost>
Also, I see a potential problem with this setup. My domain does point to my servers, and all the ports are configured correctly...however, I can't access that domain when I'm at home and on the same internal network as my servers.
Is there a setup that would do the same thing but would also allow me to utilize subdomain.localhost
or subdomain.10.0.0.*
?
What's the problem here?