Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

how to modify virtualhost in WHM?

Discussion in 'EasyApache' started by HenryMehta, Dec 4, 2017.

  1. HenryMehta

    HenryMehta Member

    Joined:
    Dec 4, 2017
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Wales
    cPanel Access Level:
    Root Administrator
    Hi

    I generally manage my Linux servers by logging in as root and doing everything from the command line (because I just do small stuff) but I've been asked to take over a WHM/CPanel Service with multiple accounts and I need to get them moved onto SSL. For the most part I've managed this with the Wordpress sites but I have a Ruby on Rails site running, with an auto SSL installed but when going to https://mysite it gives a list of the files/directories. Where in WHM can I amend the virtual host so it directs the server correctly?

    Thank you
     
  2. HenryMehta

    HenryMehta Member

    Joined:
    Dec 4, 2017
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Wales
    cPanel Access Level:
    Root Administrator
    I think I've worked out the issue, but don't know how to fix.

    The issue is httpd.conf has the line `DocumentRoot /home/mysite/public_html` but it should be `DocumentRoot /var/www/mysite/production/current/public`

    Plastered around httpd.conf it says not to edit it because changes will be overwritten, so I need to know where to make the changes so they aren't. Any help most welcome
     
  3. dalem

    dalem Well-Known Member
    PartnerNOC

    Joined:
    Oct 24, 2003
    Messages:
    2,664
    Likes Received:
    69
    Trophy Points:
    203
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. HenryMehta

    HenryMehta Member

    Joined:
    Dec 4, 2017
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Wales
    cPanel Access Level:
    Root Administrator
    So I've created the ssl conf file in the directory as per: `/etc/apache2/conf.d/userdata/ssl/2_4/user/domain/includename.conf ` and restarted the server but the file isn't being included (or is being overwritten by what was originally there). Could you advise what may be happening?
     
  5. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    668
    Likes Received:
    222
    Trophy Points:
    43
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    v68 - ea4

    I can't help thinking there is an easier way of achieving what you are trying to do

    Application Manager - Version 68 Documentation - cPanel Documentation

    Would the environment variable config.force_ssl = true be what you are looking for ?

    (Make sure you have ALL the ea modules required for rubi, passenger and mod_env)

    For reference purposes, you may also like to see:

    Guide to Ruby Installations - cPanel Knowledge Base - cPanel Documentation
    Ruby on Rails - Version 68 Documentation - cPanel Documentation
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,699
    Likes Received:
    1,790
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    The previous post offers the better approach. However, to answer your question, you won't see the names of the custom include files in the Apache configuration file. Apache is configured to automatically detect the custom includes from the appropriate directories when they are added.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. HenryMehta

    HenryMehta Member

    Joined:
    Dec 4, 2017
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Wales
    cPanel Access Level:
    Root Administrator
    Hi rpvw,

    config.force_ssl = true will force Ruby to use the https settings but if they're wrong it won't work.

    Henry
     
  8. HenryMehta

    HenryMehta Member

    Joined:
    Dec 4, 2017
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Wales
    cPanel Access Level:
    Root Administrator
    Hi, I don't understand why it is not working if this is the case. If I edit the httpd.conf file directly then the sites use the HTTPS. When I leave the same code in the include files it does not. I am missing something but I do not know what
    Henry
     
  9. HenryMehta

    HenryMehta Member

    Joined:
    Dec 4, 2017
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Wales
    cPanel Access Level:
    Root Administrator
    I've followed this instruction, mostly, and in particular where it says for the SSL add the conf file here: `/etc/apache2/conf.d/userdata/ssl/2_4/user/domain/includename.conf`

    The thing is I do not have a `/etc/apache2` directory and the relevant files seem to be in `/etc/httpd/` so I created my conf files in `/etc/httpd/conf.d/userdata/2_4/myusername/mysite.com/mysite.conf`
     
  10. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    668
    Likes Received:
    222
    Trophy Points:
    43
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    HenryMehta and cPanelMichael like this.
  11. HenryMehta

    HenryMehta Member

    Joined:
    Dec 4, 2017
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Wales
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice