Skip to main content

Using Apache .conf on a subdomain

Comments

3 comments

  • cPRex Jurassic Moderator
    Hey there! Everything you've said sounds right to me. If your include file didn't exist you may need to rebuild Apache with the /scripts/rebuildhttpdconf script to ensure it's there, but you aren't doing anything obviously wrong from the steps you described. Can you try teh rebuild script and restarting to see if that helps get things working?
    0
  • GoWilkes
    Good news! That worked :-) It's weird, when I uploaded server-wide files to /etc/apache2/conf.d/userdata/ I didn't have to rebuild, I just restarted Apache and they worked fine. Now I'm led to a second, similar question. I created the one subdomain of ww2, so now I have a directory at /home/example/ww2.example.com. But I have 60+ domains parked on top of example.com, so in cPanel I created a ww2 subdomain for each of them and set "Document root" to "/ww2.example.com". That has been working fine with using a .htaccess file. I thought that creating .CONF files at /etc/apache2/conf.d/userdata/ssl/2_4/example/ww2.example.com/01_config.conf would apply to all of the parked domains since that's the document root, but it doesn't; I had to manually copy them to /etc/apache2/conf.d/userdata/ssl/2_4/example/ww2.parked_1.com/01_config.conf to get them to work on ww2.parked.com It's obviously not very efficient to have to create 60 directories and copy the same files to each of them. Is there a better way to just have a single directory for all of them?
    0
  • cPRex Jurassic Moderator
    I'm glad the rebuild took care of the issue :D If I'm reading the second issue there correct, there's not really a better way. Each domain is going to need a separate include because of how Apache processes those files. It might be worth looking into creating a hook script of some sort that sets up the include file automatically, that gets called when you create the subdomain. While this thread is specific to an addon domain, it may get you pointed in the right direction:
    0

Please sign in to leave a comment.