0

I have about 3000 plus domains and want them to point to the same folder.

Do I have to repeat this entry 3000 times <VirtualHost domain.com:80> DocumentRoot /var/www/html ServerAlias www.domain.com </VirtualHost>

or does apache have some way to grab a list of domain names in a text file and generate the above entry?

I looked in the manual and may have missed the option if it exists.

apache 2.4 on ubuntu 16.04

Lid
  • 15
  • 5
  • Why do you want 3000 virtual hosts, instead of 1 virtual host with 3000 names? – Michael Hampton Apr 06 '19 at 00:49
  • I'd prefer that, but is that possible? So just point the dns for each of the domain names to the server's ip and have the above be the default entry? – Lid Apr 06 '19 at 01:22
  • If all the sites serve the same files, then why not? Just repeat `ServerAlias` as many times as you need. – Michael Hampton Apr 06 '19 at 01:40
  • ok that makes sense, do I even need the additional server alias entries if the A record for each domain points to the servers ip address? – Lid Apr 06 '19 at 01:47
  • Those are orthogonal. DNS only tells what your IP address is. Your web server still has to know what hostname to answer for. – Michael Hampton Apr 06 '19 at 03:34
  • So is there a way to include a text file with the 3000 domain names on the serveralias line? or does it look like ServerAlias domain1.com domain3.com domain3000.com – Lid Apr 06 '19 at 04:35
  • Sure, you can include a file, but you should probably just generate the configuration and save yourself a bunch of headaches. – Michael Hampton Apr 06 '19 at 04:43
  • I can generate it, but for ease of use for my friend it would be easier for them to just edit a text file with a domain per line. – Lid Apr 06 '19 at 04:54

0 Answers0