Apache Virtual Host Home Directory
Apache configuration is not always easy. So, this post is dedicated to Apache the VirtualHost Directive. For now I will keep it simple and just show you how to set up a VirtualHost in your home directory since that has changed with the new version and it is not obvious what you need to do.
To explain
Line 1: Opening tag for a XML-like configuration object, *:80 just means on every IP address (*) and :80 port 80 which is the default for HTTP.
Line 2: ServerName is pretty self-explanatory. It means the host name you want to choose.
Line 3: ServerAlias is an alternative name.
Line 4: DocumentRoot is you path to where your HTML documents live. Of course you could have PHP and other dynamic scripts there too.
Line 5: <Directory ${PATH}> This can usually be the same as DocumentRoot but gives more control over the directory’s configuration.
Line 6: Prioritises allowing access.
Line 7: Allows access from all hosts which is probably what you want, since it’s a public site, but here you can restrict hosts.
Line 8: This is new. To be honest, I’m not sure what this means, but it made the VirtualHost work in my home directory, which prompted me to write this post.
Line 9:
Line 11 & 12: XML closing tags.
Comments