Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have my URL (example.com:8010) pointing to my server, which works and goes to the /var/www directory properly. I created another vhost file to go to the test directory but when I type the URL for that in with a subdomain it does not work (test.example.com:8010), only typing it in with a slash works (example.com:8010/test).

EDIT: Something I forgot to mention is that when I do go to test.example.com:8010 it goes to the default /var/www folder, and that typing text.example.com:8010/test obviously goes to the test folder.

Here is my vhost for the two entries:

Example.com -

<VirtualHost *:80>
        ServerName example.com
        ServerAdmin admin@example.com
        DocumentRoot /var/www
        <Directory /var/www/>
                AllowOverride All
                Order Deny,Allow
                Allow from All
        </Directory>
</VirtualHost>

<VirtualHost *:8010>
        ServerName example.com
        ServerAdmin admin@example.com
        DocumentRoot /var/www
        <Directory /var/www/>
                AllowOverride All
                Order Deny,Allow
                Allow from All
        </Directory>
</VirtualHost>

Test.Example.com -

<VirtualHost *:80>
        ServerName test.example.com
        ServerAdmin admin@example.com
        DocumentRoot /var/www/test
        <Directory /var/www/test/>
                AllowOverride All
                Order Deny,Allow
                Allow from All
        </Directory>
</VirtualHost>

<VirtualHost *:8010>
        ServerName test.example.com
        ServerAdmin admin@example.com
        DocumentRoot /var/www/test
        <Directory /var/www/test/>
                AllowOverride All
                Order Deny,Allow
                Allow from All
        </Directory>
</VirtualHost>

I should also mention that I have another vhost for that test directory set up so that on my local network i can type test.lacol and it goes to that directory, which works:

<VirtualHost *:80>
            ServerName test.lacol
            ServerAdmin admin@example.com
            DocumentRoot /var/www/test
            <Directory /var/www/test/>
                    AllowOverride All
                    Order Deny,Allow
                    Allow from All
            </Directory>
    </VirtualHost>

    <VirtualHost *:8010>
            ServerName test.lacol
            ServerAdmin admin@example.com
            DocumentRoot /var/www/test
            <Directory /var/www/test/>
                    AllowOverride All
                    Order Deny,Allow
                    Allow from All
            </Directory>
    </VirtualHost>
share|improve this question

3 Answers 3

http://httpd.apache.org/docs/2.2/vhosts/examples.html

Looks like you have <VirtualHost> *:80> spelled incorrectly. Should be <VirtualHost *:80>

share|improve this answer
    
Fixed the formatting but it did not fix the issue. –  CR47 Oct 9 '13 at 19:11

Have you configured yous site at /etc/hosts? If you have, look at your php.ini and look for your open_basedir configuration. open_basedir, if set, limits all file operations to the defined directory and below.

If it is not defined, look at your /var/log/apache2/error.log. Maybe it can help you.

share|improve this answer
up vote 0 down vote accepted

I had to enable the site.

sudo a2ensite example.com

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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