I set up my subdomain with my registrar of "test" point to my server ip. Everything connects and the subdomain works, but it's pointing to /var/www/html instead of /var/www/test

I restarted apache and checked the logs. I'm confused:

<VirtualHost *:80>
    ServerName www.test.example.com
    ServerAlias test.example.com
    DocumentRoot "/var/www/test/"

Note that this has it's own conf file and the permissions are correct for /var/www/test - I also put in an index.php with dummy text to check it. No luck

Any input is appreciated!

  • Should I put this in httpd.conf rather than it's own conf file? – user1062058 Sep 24 '12 at 20:36

You can only put this in its own .conf file if httpd.conf is including it.

Firstly, start by putting it at the bottom of your httpd.conf, that'll ensure you at least have the right one.

Once it works, you can see what directory apache includes by looking for an Include directive. If there isn't one, add it. There should be one like Include conf.d/*.conf - this means you can put it in your conf.d folder and as long as it has an extension of .conf, it'll be included by httpd.conf.

Note that you will need to have NameVirtualHost in order to use <VirtualHost>s.


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.