The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Edit Apache directives for a virtual host

Discussion in 'EasyApache' started by milindras, Feb 1, 2011.

  1. milindras

    milindras Member

    Joined:
    Dec 29, 2010
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    Hi,
    I have few sites on my server & I need to edit the apache directive for selected sites.
    My OS is CentOS & running cpanel newest version. I can't see a place in cpanel to change directives for a selected site.
    Does CentOS keep seperate virtual host file for each site? On Ubuntu I can see like that.

    What is the best way to do this?

    many Thanks
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    What are you specifically needing to change? Depending on what is needing changed, it might need to be done differently. If you are adding individual VirtualHost directives, those need to go into an include file for the user. If you are modifying existing VirtualHost directives, you'd have to edit the userdata file for the user.

    If you are editing global directives, you'd have to edit the Apache template file by copying it and making changes. If you are adding global directives, you'd need to add them into one of the global include files.

    You can review the various include locations in the following documentation:

    The Apache Web Server and cPanel & WHM

    Thanks.
     
  3. milindras

    milindras Member

    Joined:
    Dec 29, 2010
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    Hi,
    Thanks for the reply.
    Lets say for a selected domain, in the apache virtual host I want to add the wildcard capability
    Example
    ServerAlias www.mydoamin.co.uk need to replace with
    ServerAlian *mydomain.co.uk

    Thanks
    Milindra
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Milindra,

    Would there be a reason you do not simply add a wildcard subdomain onto the account in cPanel or park a wildcard onto cPanel? You can certainly edit the VirtualHost directive, but it seems like that's overkill when it should be something you can add in cPanel > Subdomains or cPanel > Parked Domains area.

    To edit the ServerAlias lines, you simply need to edit /var/cpanel/userdata/username/mydomain.co.uk file and add the wildcard in the serveralias: line it will have. Replace username with the cPanel username in that path, and replace mydomain.co.uk with the actual domain name.

    You'd also have to add a parked domain entry in /var/cpanel/userdata/username/mydomain.co.uk/mail file.

    Thanks.
     
Loading...

Share This Page