i need to add ServerAlias *.mydomain.com to <VirtualHost>

Discussion in 'Site & Server Administration' started by 123GoToAndPlay, Apr 28, 2009.

  1. #1
    how would i do that??
     
    123GoToAndPlay, Apr 28, 2009 IP
  2. yaax

    yaax Active Member

    Messages:
    117
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #2
    If your server has CPanel, then from its new versions it can add wildcarded subdomain like you wish by just adding regular subdomain from Cpanel client interface, you can add there subdomain *.mydomain.com and Cpanel will add apropriate record to apache conf file.

    If you dont have Cpanel server, then you will have to edit apache conf file manually if you have root access or ask your host to do this.
     
    yaax, Apr 29, 2009 IP
  3. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #3
    First, you will need root access of the server. If you are on shared server you will need to update your host to make this changes.

    If you own your dedicated server locate httpd.conf file. If you are not sure about exact path you can use locate command:

    locate httpd.conf

    Then open the file in editor (vi, pico etc.) and search for your domain's entry. There will be one entry like ServerAlias www.yoursite.com.. Just edit this line and save it. Do not forget to restart Apache.

    Kailash
     
    kailash, Apr 30, 2009 IP
  4. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    @Kailash,

    i can't find httpd.conf in /var/www/vhosts/domain.com/conf/

    just httpd.include

    Now i read a tiny bit about vhost.conf

    Should i create >vhost.conf or >httpd.conf

    and all i need is ServerAlias *.mydomain.com, right?
     
    123GoToAndPlay, May 4, 2009 IP
  5. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #5
    I believe you are using plesk so you do not need to create any new file. Just edit httpd.include and search for ServerAlias in this file and then make the required changes.

    Kailash
     
    kailash, May 4, 2009 IP