LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache 2 wildcard subdomain (https://www.linuxquestions.org/questions/linux-newbie-8/apache-2-wildcard-subdomain-4175448903/)

conflicker 02-06-2013 11:33 AM

Apache 2 wildcard subdomain
 
Hi everybody,

I'm running Linux Ubuntu 11 on my local machine and able to install LAMP and it works properly. I create a Virtual Host for me to run example.local on my local machine, and it's working very well.

Now, the problem is I'm trying to setup wildcard for the domain so it will look like something sub1.example.com. I tried to put *.example.com for ServerName of my VirtualHost but it's no good.

Please help if you have any idea, that would be much appriciated.

Thank you,

Conflicker

frieza 02-06-2013 01:11 PM

have you tried removing the *. and just using .example.com?
such as
Code:

<VirtualHost *:80>
DocumentRoot "/document/root"
ServerName .gotdns.com
<Directory "/document/root">
AllowOverride All
allow from all
Options +Indexes
</Directory>
</VirtualHost>

no I haven't tried that to know whether or not it works, but it's worth a shot.

chrism01 02-06-2013 05:32 PM

You can't use wildcards for ServerName, but you can for ServerAlias
Code:

ServerAlias eu.example.com us.example.com www*.example.com

freelinuxtutorials 02-06-2013 08:01 PM

you can try something like this on your conf

<VirtualHost 192.168.1.100:80>
DocumentRoot “/var/www/html/flt/subdomains”
ServerName freelinuxtutorials.com
ServerAlias *.freelinuxtutorials.com
<Directory /var/www/html/flt/subdomains>
Options Includes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>


All times are GMT -5. The time now is 02:01 AM.