Subdomain wildcards

Discussion in 'Installation/Configuration' started by steven_twente, Sep 29, 2006.

  1. steven_twente

    steven_twente New Member

    Hi all,

    I was wondering whether I can configure a subdomain wildcard in ISPConfig or whether I will need to add it to the Apache config manually? The functionality I'm looking for would provide me with an easy way of doing approximately this (in the apache config):

    So any subdomain points to the same directory. I do not need to change the standard directory where ISPConfig puts the standard files, I just want the wildcard functionality. I didn't find anything on this forum about this functionality, only something about wildcards in SSL certificates but I don't need that. I've tried setting *.mydomain.com as a Co-Domain in ISPConfig, but that didn't work.

    Is there a way to do this?

    Thanks in advance!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Wildcards are not officially suppoerted in ISPConfig, but it might worj like this:

    1) Create a new website with:

    host: *
    domain: mydomain.com

    You must set mailserver to external in the website settings, otherwise you will break your postfix configuration. You will be able to receive emails for this web by adding a co-domain with empty host field and mydomain.com in the domainfield. Do not set the co-domain to external mailserver.
     
  3. steven_twente

    steven_twente New Member

    Wow you guys reply fast! Great support :)

    Thanks a lot for your answer. Unfortunately the domain I want to give that wildcard functionality is already completely configured in ISPConfig. I do not want to take the risk of messing it all up :p I think I will try your solution when I add a new web to my server. If I do I will post my results here.

    For the time being I will just configure it manually in apache. I don't suppose ISPConfig will have any problems with that?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You should be able to do this changes on a existing website as well, just set the mailserver to external and then replace the www in the host field of the website settings. If it does not work after about 1 minute, revert the changes.

    This will only work if the domain is not configured in ISPConfig at all and you add your configuration directly in your httpd.conf or apache.conf file. ISPConfig will wipe out any changes you do in the Vhost_ispconfig.conf file manually.
     
  5. steven_twente

    steven_twente New Member

    Ok, thanks I'll try that.

    I've also found a httpd.conf here:
    Code:
    /root/ispconfig/httpd/conf/httpd.conf
    Does ISPConfig wipe out changes made to that file as well? I'm not used to these split up conf files. I'm used to one httpd.conf file in which I can manually edit anything, including VirtualHosts. This is not the case with this httpd.conf file located in the ispconfig directory?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Never change this file! It is only for the controlpanel, not for your hosted websites.
     
  7. steven_twente

    steven_twente New Member

    Thanks a lot, you may have just saved me from a lot of trouble :)
    I'm not sure it depends on the version of apache or something but on my other server running FreeBSD and Apache 2.1.9 (not running ISPConfig) all the VirtualHost settings are located in this one httpd.conf file. Anyway, thanks again. I'll try your solution and post the results here. :)
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    The apache conf file you are seeking is one of the following files (depending on your linux distribution):

    /etc/apache/apache.conf
    /etc/apache2/apache2.conf
    /etc/apache/httpd.conf
    /etc/apache2/httpd.conf
     
  9. steven_twente

    steven_twente New Member

    Yes, it appears some things are different than I am used to. The httpd.conf files are only present for compatability reasons. The apache2.conf file looks a lot like the thing I'm looking for. Thanks :)

    While I'm at it; I hope you don't mind if I ask some more questions?

    ***This question is no longer valid: see the edit below***
    I noticed that ISPConfig can create default MX records for hostname.domain.com when the hostname+domain are added to ISPConfig. Since it is impossible to add a domain without supplying the hostname (defaults to 'www') the default MX record would be for email to "@www.domain.com". Am I right? So what if I were to add *.domain.com to ISPConfig? Would the default MX record be for <nohostname>.domain.com? Such that (as you mentioned before) all e-mail for all subdomains of the specified domain would be delivered to the same mailserver?

    Then hopefully my last question:

    When looking at the Vhosts_ispconfig.conf file I noticed the following:
    When I get error messages from apache I also notice
    with webmaster being a link for "mailto:root@localhost".

    I suppose these two are connected? I would ofcourse like "root@localhost" to be "[email protected]". If ISPConfig wipes out the settings if I change this in the Vhosts file, can you tell me where I can find these settings in ISPConfig? I've already filled in the right stuff via "Management -> Server--Settings -> Server" but that doesn't seem to have effect.

    Thanks in advance!

    =======
    EDIT:
    =======

    I've tried your approach for adding the wildcard feature like this:
    Unfortunately though, ISPConfig does not allow me to specify '*' as the hostname.
    ISPConfig throws me this error:

    Too bad that doesn't work.

    I've also tried manually editing the apache2.conf file and after a few tries I think I got it right.
    I've added the following to apache2.conf:

    Code:
    <VirtualHost my.ipa.ddr.ess:80>
        ServerName *.mydomain.com:80
        ServerAdmin [email protected]
        DocumentRoot /var/www/web#/web
    </VirtualHost>
    This causes *.mydomain.com to point to the right directory. I'm not sure how cgi and everything are going to work like this, but for the time being this will suffice. Thanks again for your help! It would be great if you could help me with my other questions posted above. :D
     
    Last edited: Sep 29, 2006
  10. falko

    falko Super Moderator ISPConfig Developer

    It should be ServerAdmin [email protected], except for the SharedIP vhost. Please check again.
     
  11. steven_twente

    steven_twente New Member

    I'm sorry, I wasn't clear enough. The ServerAdmins of my registered domains are correct, but I would like the SharedIP vhost's ServerAdmin to be webmaster@serverhostname. But since I recently made the server's hostname point to one of my other domains, people no longer see the SharedIP page when using the machine's hostname in their browser. Therefore I no longer need to change the SharedIP vhost's ServerAdmin. Thanks for your reply and sorry for the rather useless question.
     
  12. falko

    falko Super Moderator ISPConfig Developer

    You could change it in the function make_vhost() in /root/ispconfig/scripts/lib/config.lib.php.
     
  13. steven_twente

    steven_twente New Member

    Ah thanks! I'll look into that.
     

Share This Page