Skip to main content

Add ServerAlias to all/some accounts?

Comments

6 comments

  • eminos
    The closest thing to a solution I've been able to find is to park the subdomain (username.preview.myhostingcompany.com) on the user domain via WHM. That could be a solution for my needs BUT it doesn't seem to work properly and it seems to have messed up the httpd.conf file! Now I have unparked the subdomain but the VirtualHost for the user is now right at the bottom of the httpd.conf below "Define the main cPanel & WHM proxy subdomains".
    ################################################## ################################################## # # Define the main cPanel & WHM proxy subdomains # ################################################## ################################################## NameVirtualHost 123.123.123.123:80 NameVirtualHost 123.123.123.123:443 ServerName userdomain.se ServerAlias mail.userdomain.se www.userdomain.se DocumentRoot /home/userdomain/public_html ......
    Maybe this issue is serious? Maybe even a cPanel bug? And maybe it's related to that the server hostname is server6.myhostingcompany.com and at the same time I have a user that uses that main domain (myhostingcompany.com).
    0
  • eminos
    Now I've manually run /usr/local/cpanel/scripts/rebuildhttpdconf and the httpd.conf seems to be back to normal. So what could have been wrong here? I parked and unparked that preview subdomain from WHM, and it messed up httpd.conf.
    0
  • cPanelJasonT
    Hello, I believe that the user include should be effective for what you are trying to do. The ServerAlias directive supports multiple entries for one vhost. However, if you are trying to utilize an additional hostname for the same Alias and document root, the thing you want to is to use an Alias in cPanel. This is essentially the same as Parking a domain in WHM and is the best way to keep the hosting manageable from cPanel. Documentation for this feature is available here: Aliases - Version 64 Documentation - cPanel Documentation
    0
  • Anoop P Alias
    You may be able to edit the apache vhost template too in /var/cpanel/templates/apache2_4/
    0
  • eminos
    Sorry but none of your answers really answers my question. Or maybe I wasn't clear enough. To create the Alias that I need I need to enable the possibility to add Aliases on OTHER users domains in Tweak settings in WHM. Which is, of course, a big security issue, so that's not really an option. Also, when I do it that way I get that messed up httpd.conf described above. Would be interesting to hear if this is the expected behavior or a bug (see code snippet in OP .. doesn't look right?). To edit the Apache vhost template, yes, I can do that, which I also mentioned in my first post (although not very clear, I wrote about the .local template, which should override the default vhost template). This solution works as expected, BUT then I need to follow up on changes that are made to that template with new cPanel versions. My question was if there is a solution that doesn't have those problem described above. It seems there is no better way, but to just edit the vhost template and keep checking if cPanel makes any changes to it with every major (or even minor) update...
    0
  • cPanelMichael
    The closest thing to a solution I've been able to find is to park the subdomain (username.preview.myhostingcompany.com) on the user domain via WHM. That could be a solution for my needs BUT it doesn't seem to work properly and it seems to have messed up the httpd.conf file!

    Hello, Could you open a support ticket using the link in my signature so we can take a closer look at the affected system's Apache configuration file when adding the alias? You can post the ticket number here so we can update this thread with the outcome. Thank you.
    0

Please sign in to leave a comment.