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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED User for main website

Discussion in 'Bind / DNS / Nameserver Issues' started by ebar, Jan 17, 2017.

  1. ebar

    ebar Member

    Joined:
    Jan 17, 2017
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    US
    cPanel Access Level:
    Root Administrator
    I have a fresh install of WHM/cPanel on CentOS 7.

    I ran into an odd issue. Lets say my cpanel server hostname is cpanel.mydomain.com.

    After a fresh install of WHM/cPanel, I went to www.mydomain.com and get the default 404 page. Perfect, to be expect.

    So I created a cPanel user to try to manage that domain and so I could add email address to it. I created the user with the domain: mydomain.com. I then went ahead and tossed a phpinfo() file into the directory for that user, which was whatever the virtual host directory cpanel made was.

    That all worked great. Until I realized that if I went to mydomain.com using SSL, it still pointed to the default apache directory of /var/www/html.

    What am I doing wrong here? Is there a way to configure an account for MY website for mydomain.com using the main apache directory instead of some new random vhost directory?
     
  2. ebar

    ebar Member

    Joined:
    Jan 17, 2017
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    US
    cPanel Access Level:
    Root Administrator
    Also I don't think I meant to make this thread in this directory. Meant to put it in general.
     
  3. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    568
    Likes Received:
    40
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Have you installed SSL on your domain through WHM ?
     
  4. ebar

    ebar Member

    Joined:
    Jan 17, 2017
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    US
    cPanel Access Level:
    Root Administrator
    So disregard the SSL thing. I did more testing. This thing is whack.

    I modified my userdata conf file to change its document root to /var/www/html. Which at first test seemed to work. But no. Things are even more ridiculous.

    Going to mydomain.com redirects to mydomain.com/cgi-sys/defaultwebpage.cgi, despite having uploaded my website to my new document root (and yes I did rebuild the httpd.conf file). But I found out the doing mydomain.com/info.php brings me to the phpinfo file I uploaded. So I tried going to index.php and it brings up the website. So it SEEMS apache isn't recognizing my default index page, and gives me that weird 404 redirect. However, it should give me a directory listing right? It does for other directories.

    So I went to cpanel.mydomain.com (which is my FQDN for cpanel) and it brings up my site, even without adding the /index.php. Wtf settings have I screwed up, mis-configured, or failed to configure?

    In conclusion: (-> means "results in")
    mydomain.com -> mydomain.com/cgi-sys/defaultwebpage.cgi (it should load index.php)
    mydomain.com/index.php -> mydomain.com/index.php (as one would expect)
    cpanel.mydomain.com -> mydomain.com/index.php (this is the behavior I want for mydomain.com)

    So confused. In plesk I've never had an issue like this. Not sure where I went wrong.
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,766
    Likes Received:
    313
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Is there an actual cPanel account created with the domain? You can use that domain for the hostname of course, but you will need to create an actual cPanel account to use it as an account.
     
  6. ebar

    ebar Member

    Joined:
    Jan 17, 2017
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    US
    cPanel Access Level:
    Root Administrator
    Well that's just it. After the install of WHM/cPanel, there are no accounts created. Just the default WHM root account.

    So yes, I created a cPanel account for mydomain.com. Thats when it changed mydomain.com's document root away from /var/www/html for "some" URLs (even though they should all go to the same spot).

    Once freshly installed, all you should have to do is create a user account for mydomain.com right? (with cpanel's hostname being cpanel.mydomain.com)
     
  7. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,766
    Likes Received:
    313
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    I had a feeling that was the case. The root account is not an actual account you can use for websites/mail by default.

    Yes, and no, IMO. I wouldn't suggest using cpanel in the hostname.
    Tweak Settings - Domains - Documentation - cPanel Documentation
    Proxy Subdomains Use the cPanel Service SSL - cPanel Knowledge Base - cPanel Documentation
     
  8. ebar

    ebar Member

    Joined:
    Jan 17, 2017
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    US
    cPanel Access Level:
    Root Administrator
    Well that I basically figured out. So thats when I created the user account for my main domain name, mydomain.com.

    I did read that proxy domains are enabled by default (which I also verified in the Tweak Config). It doesn't seem to be working though. https://cpanel.mydomain.com just goes to the root directory for that vhost (/var/www/html/cpanel). You'll notice I specified https. When using http, it doesn't seem to recognize the default index.php/.html pages I have in there, so then it redirects me to that cgi-sys/default page.

    I'm looking through the .conf files, and can't figure out why the default index files aren't being recognized by Apache when using standard http. I think this may be my issue that's been confusing me and making me think something else is amiss.
     
  9. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,766
    Likes Received:
    313
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Does that domain come up in your browser properly or no?

    What are your redirection settings here:
    WebHost Manager »Server Configuration »Tweak Settings, Redirection tab

    Assuming mydomain.com resolves properly, place an index.html in the public_html of the mydomain.com account you created.
    /home/cpanelusername/public_html/
     
  10. ebar

    ebar Member

    Joined:
    Jan 17, 2017
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    US
    cPanel Access Level:
    Root Administrator
    Off (default)

    I do have an index.php in /home/swc/public_html (swc is the correct cpanel username for mydomain.

    Also I noticed my browser was sometimes auto-filling the https and I didn't realize it. So I retested all possible URLs, below are the results: (I also put a file in both /var/www/html/ and /home/swc_public_html/ with output indicating where that file is located, to prevent more confusion).

    (http://)(www.)mydomain.com -> These all get redirected to the file /usr/local/cpanel/cgi-sys/defaultwebpage.cgi
    https://(www.)mydomain.com -> Pulls up /var/www/html/index.php

    (http://)(www.)mydomain.com/index.php -> Pulls up /home/swc/public_html/index.php
    https://(www.)mydomain.com/index.php -> Pulls up /var/www/html/index.php

    ------

    Edit: I cannot even figure out how the hell this thing is redirecting to that cgi-sys/default page. I deleted the index.html that had a meta-redirect to the default webpage. I checked the source of virtually all other cpanel generated files, nothing redirects to it. I checked the httpd.conf and every other generated .conf file, it is mentioned exactly ZERO times. This makes no sense.
     
    #10 ebar, Jan 17, 2017
    Last edited: Jan 18, 2017
  11. ebar

    ebar Member

    Joined:
    Jan 17, 2017
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    US
    cPanel Access Level:
    Root Administrator
    Final post:

    It seems I fixed it. First thing I did was rebuild the httpd.conf file after creating my cPanel account for mydomain.com Then restarted httpd.

    That cleaned up and actually made the .conf file represent what my cPanel settings were. However, I still had this ridiculous redirect that seemed to summon itself out of nowhere.

    I went ahead and cleared my browser cache across all devices (google sync and all), and it finally works.
     
    Infopro likes this.
Loading...

Share This Page