Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a BIG problem. I have VPS with Debian OS, and LAMP installed. Fresh install. For control panel i using Webmin. Now i trying to setup multiple sub-domains on my server using webmin for example:

downloads.my-domain.com
cpanel.my-domains.com
forum.my-domains.com

But problem what is happening is next, while i using no virtual hosts, everything works perfectly when i accessing it using my-domain.com, but when i add Virtual host, i cann access it but my-domain.com becomes unavilable because it redirects to virtual hosts i added. When i add more than 2 virtual hosts, problem is still here. Also, when i try to access to virtual server for example downloads.my-domain.com, it redirects again to cpanel.my-domains.com When i delete virtual hosts, access to my-domain.com is succesfull...

What i known:

- That is not problem with my domain provider. I correctly added subdomains and added host record to my VPS IP.
- I added unique name to every single virtual host. 
- There are no two same virtual hosts  - Every virtaul hosts have own directory: for example: downloads.my-domain.com have own WWW dir: /var/downloads

Can somebody help me? Thanks.

share|improve this question

closed as off-topic by masegaloeh, mdpc, Hyppy, Katherine Villyard, Flup May 1 at 8:09

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 1 down vote accepted

I fixed it by deleting all exist virtual hosts and manualy adding these code to my httpd.conf for each virtual host:

<VirtualHost *:80>
        ServerAdmin admin@my-domain.com
        DocumentRoot "/var/www/download.my-domain.com"
        ErrorLog /var/www/error_download.log
        CustomLog /var/www/access_download.log common
        ServerName download.my-domain.com
        ServerAlias download
        <Directory "/var/www/download.my-domain.com">
                AllowOverride All
        </Directory>
</VirtualHost>

So if you have(or you haved) same problem, just edit these lines to match your own criteria and use it.

You can use this editor/generator which i just created, to customize this code. http://apps.elite7hackers.net/vhosts/

share|improve this answer

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