Skip to main content

Custom VirtualHosts

Comments

11 comments

  • cPanelMichael
    Hello @Senor, You can follow the steps referenced below to control which content appears when navigating directly to an IP address: 1. Navigate to WHM's Include Editor interface (WHM Home >> Service Configuration >> Apache Configuration >> Include Editor). 2. Select the Pre Virtual Host Include option. 3. Select the Apache version from the menu. We recommend that you select All Versions. 4. Enter the following text in the available text box: ServerName HOSTNAME DocumentRoot /usr/local/apache/htdocs ServerAdmin EMAIL suPHP_UserGroup nobody nobody ServerName HOSTNAME DocumentRoot /usr/local/apache/htdocs ServerAdmin EMAIL suPHP_UserGroup nobody nobody SSLEngine on SSLCertificateFile SSLCERTIFICATEFILE SSLCertificateKeyFile YOUR-SSLCERTIFICATEKEYFILE
    Note: This example uses the following values:
    • IPADDRESS represents your IP address.
    • HOSTNAME represents your server's hostname.
    • EMAIL represents your contact email address.
    • SSLCERTIFICATEFILE represents the full file path to your SSL certificate.
    • SSLCERTIFICATEKEYFILE represents the full file path to your SSL certificate's key.
    5. Click Proceed 6. Click Update. Additionally, note that you'd need to update the DocumentRoot values to reflect the directory associated with the content you want to load. Thank you.
    0
  • Senor
    That sort of did it. Accessing via IP () showed the correct website. Not sure what I'm missing. Thanks for all the help!
    0
  • cPanelMichael
    Hello @Senor, Can you share the specific entry you added? Simply replace real domain names, usernames, and IP addresses with examples. Thank you.
    0
  • Senor
    Sure. I only did the non-secure (port 80) entry: ServerName host.domain.com DocumentRoot /home/user/www/ ServerAdmin me@foo.bar suPHP_UserGroup nobody nobody
    0
  • Senor
    Hmm. If I'm behind a firewall, do I need to have entries for both my internal and external IPs? I only have one for my internal IP. Perhaps that's why it's not working?
    0
  • cPanelMichael
    DocumentRoot /home/user/www/

    Try setting this to "/home/user/public_html/".
    Hmm. If I'm behind a firewall, do I need to have entries for both my internal and external IPs? I only have one for my internal IP. Perhaps that's why it's not working?

    The entry should utilize the internal IP address (assuming you've setup
    0
  • Senor
    Try setting this to "/home/user/public_html/".

    Awesome, that did it. Thanks for all the help!
    0
  • cPanelMichael
    Awesome, that did it. Thanks for all the help!

    I'm glad to see that worked. Thanks for sharing the outcome! I've marked this thread as solved.
    0
  • Senor
    @cPanelMichael Ok, so while I thought this was solved, twice now in the middle of the night, my server started returning 403 errors when accessing it by its IP. I had to update the permissions of my public_html folder to 0755 for everything to start working again. It'd be real nice if that stuck so I wasn't woken up at 3 in the morning to make the change. Accessing by its hostname works without problems (prior to the permissions change, too). Thoughts?
    0
  • cPanelMichael
    Hello @Senor, It's possible the support ticket so we can take a closer look to see if that's the case? You can post the ticket number here and we'll update this thread with the outcome. Thank you.
    0
  • Senor
    @cPanelMichael I've disabled that feature and will update if the issue happens again. Thanks again for all your help.
    0

Please sign in to leave a comment.