2

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>
0

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

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

1
  • Fixed the formatting but it did not fix the issue.
    – CR47
    Oct 9 '13 at 19:11
0

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.

0

I had to enable the site.

sudo a2ensite example.com

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.