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 [Case CPANEL-20422] New account redirects to defaultwebpage in 70

Discussion in 'General Discussion' started by swbrains, May 13, 2018.

  1. swbrains

    swbrains Well-Known Member

    Joined:
    Sep 13, 2006
    Messages:
    91
    Likes Received:
    7
    Trophy Points:
    158
    Hi,

    Just migrated from one cPanel server to another cPanel server due to a hardware issue. Both Centos 7, new one has cPanel 70 vs. 68 on old server.

    Here's the issue (worked fine on old server): I create a new account as a subdomain under my main domain and all skeleton directory files are preloaded perfectly. Account directory looks good on server. I go to a DNS query site and check the DNS of the new subdomain (mynewsite.example.com) and it shows an authoritative answer for the subdomain pointing to the shared IP on my server for that new account.

    But if I try to go to the new site in my browser I get the defaultwebpage redirect. I try clearing my browser cache (even though I've never accessed the new subdomain before), and it still redirects. If I try to access a distinct page or script on the new account, I get the default 404 page.

    I try over and over, clearing my browser cache between every try and it still redirects. Finally, if I do nothing and wait about 5 minutes, it resolves and loads the site perfectly!

    The problem I have is that new sites were accessible immediately on the old server, and I have an automated process that creates my new accounts, and it needs to run some scripts on the new account immediately after creation, but the calls to those scripts return 404 errors, whereas they ran perfectly on the old server. I even have a 30-second delay after account creation before tying to execute the site's scripts but it still fails.

    Is there some internal table on the server not being updated quickly enough? I can see that the DNS is fine since I query it immediately and it shows a proper A record, but once the server gets the request, it can't seem to find the site. And then it resolves itself automatically after several minutes.

    Any ideas what might be going on?

    Thanks!
     
  2. swbrains

    swbrains Well-Known Member

    Joined:
    Sep 13, 2006
    Messages:
    91
    Likes Received:
    7
    Trophy Points:
    158
    FYI: I have found if I restart Apache (httpd) manually through cPanel after creating the new account, it works fine immediately. This is very consistent when creating new accounts.

    The problem is, on my old server I didn't have this issue and didn't need to restart Apache manually each time I added an account, and I didn't have to wait. Since my accounts are created by a script that needs to access the new account itself, this won't work as a solution. Hopefully the additional info may be useful in diagnosing this issue.

    Thanks!
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,245
    Likes Received:
    1,759
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @swbrains,

    Thanks for the report. Check to see if you notice the following message in /usr/local/cpanel/logs/queueprocd.log upon creating an account:

    Code:
    warn [queueprocd] install_best_available_certificate_for_domain exited with value 127 at /usr/local/cpanel/Cpanel/LoggerAdapter.pm line 27.
    If so, note that internal case CPANEL-20422 is open to address an issue in cPanel & WHM version 70 where Apache is not automatically restarted upon the creation of a new account in cases where /usr/local/cpane/bin/install_best_available_certificate_for_domain fails to install a certificate during the account creation process. I'll monitor this case and update this thread again once the solution is published. The temporary workaround is to manually restart Apache after creating new accounts.

    Thank you.
     
  4. swbrains

    swbrains Well-Known Member

    Joined:
    Sep 13, 2006
    Messages:
    91
    Likes Received:
    7
    Trophy Points:
    158
    Hi Michael,

    I created a new account just now (which is experiencing the issue) and then checked the log file. Here's the section at the end relevant to this new site's creation:

    Code:
    apache_php_fpm restarted successfully.
    WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
    Updating FTP passwords for vinnie17
    FTP password files updated.
    FTP vhost passwords synced
    WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
    WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
    zone reload up-to-date
    WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
    zone reload up-to-date
    There is no certificate available for the domain: vinnie17.xxxxxxx.com.
    [2018-05-14 10:33:41 -0500] info [queueprocd] PHPFPM: ensure_fpm_on_boot executing
    [2018-05-14 10:33:43 -0500] info [queueprocd] PHPFPM: ensure_fpm_on_boot completed
    
    I did see one instance of "install_best_available_certificate_for_domain" earlier in the log, but I think this one was issued during the time the accounts were being restored from a backup during server migration to this server from the old one, and it was a different exit value than you specified (2):

    Code:
    [2018-05-12 22:53:05 -0500] warn [queueprocd] install_best_available_certificate_for_domain exited with value 2 at /usr/local/cpanel/Cpanel/LoggerAdapter.pm line 27.
        Cpanel::LoggerAdapter::warn(Cpanel::LoggerAdapter=HASH(0xae3c88), "install_best_available_certificate_for_domain exited with val"...) called at /usr/local/cpanel/Cpanel/TaskQueue/FastSpawn.pm line 74
    
    Not sure if it's relevant, but since this appears to be related to installing certificates (SSL I presume), we have AutoSSL turned off on the new server as we don't want self-signed certs being installed and we have our own apps that handle installing and renewal SSL certs for our customers.

    Unfortunately for us, the temporary workaround of restarting apache won't work, as our sites are created by a script automatically for customers when they sign up, and part of that script is to access the new site after creation and run some scripts on that site, which it now can't reach, so this is a blocking issue for us with regard to accepting new customers.

    Hope this helps! Let me know if you need any additional information.
     
    #4 swbrains, May 14, 2018
    Last edited: May 14, 2018
  5. Seyed

    Seyed Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    skinak
    cPanel Access Level:
    Website Owner
    Hello
    I have the same problem
    Please support the C-Panel to solve this problem.
    But I found a temporary solution
    You must have the following code:
    service httpd restart
    Place the code above in the following file
    /usr/local/cpanel/scripts/legacypostwwwacct

    To reset apachi after account creation
     
  6. swbrains

    swbrains Well-Known Member

    Joined:
    Sep 13, 2006
    Messages:
    91
    Likes Received:
    7
    Trophy Points:
    158
    That's an interesting workaround. Is this script applicable to CentOS 7 and cPanel 70? I'd like to hear what cPanel think of this workaround, and exactly where in the legacypostwwwacct script the restart command should be placed. Any negative impacts expected from doing this?
     
  7. Seyed

    Seyed Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    skinak
    cPanel Access Level:
    Website Owner
    I tested On cpanel 70 and CentOS6 and CentOS7
    I do not know about negative impacts:(:(
     
  8. swbrains

    swbrains Well-Known Member

    Joined:
    Sep 13, 2006
    Messages:
    91
    Likes Received:
    7
    Trophy Points:
    158
  9. swbrains

    swbrains Well-Known Member

    Joined:
    Sep 13, 2006
    Messages:
    91
    Likes Received:
    7
    Trophy Points:
    158
    I've been poking around the cPanel docs, and it looks like the "script hooks" are deprecated and now cPanel is changing to "Standardized Hooks" (which unfortunately looks significantly more complicated to implement than simply editing a script):
    Tutorial - Create a Standardized Hook - Developer Documentation - cPanel Documentation
    While I think the script method would work just fine, I'm now concerned that it will simply stop working without warning one day since it's deprecated. :(

    While I felt confident editing a script to add one line to restart Apache, I don't feel confident (although I can write Perl scripts) with the 12-step hook registering process described in the link above. Seems a shame they made the hooking process so complicated. Having simple scripts that run before and after key processes seemed like a pretty simple and effective solution.
     
  10. swbrains

    swbrains Well-Known Member

    Joined:
    Sep 13, 2006
    Messages:
    91
    Likes Received:
    7
    Trophy Points:
    158
    For what it's worth, I did try the postwwwacct script to restart httpd after an account is created, but it had an unintended consequence. My account creation script that lets customers sign up for a site calls the cPanel API to create an account while displaying a page with a "please wait" message for about 30 seconds before forwarding them to another page that says their site is ready (and sends a welcome email at the same time).

    Unfortunately, restarting Apache in the middle of all that causes the browser to issue it's "no data error" or something like that before being able to redirect. Did I just restart the service that the script was running under? Regardless, even this workaround won't work for me.

    Oddly this all worked perfectly on the old server with the same Centos7 and and cPanel 68, so I don't know now if it's a bug in 70 or if there's just some difference in how the new server (or cPanel) is configured. Both servers were deployed at the same server farm, so they should have been fairly similarly configured by default.
     
  11. swbrains

    swbrains Well-Known Member

    Joined:
    Sep 13, 2006
    Messages:
    91
    Likes Received:
    7
    Trophy Points:
    158
    I've been doing some additional troubleshooting and I did finally come up with a solution that works for me, even if it uses the deprecated script hooks method. :)

    Working of Seyed's idea of the postwwwacct script, I noticed first I didn't have one, so I created it in the /scripts folder.
    Next, I added: service httpd restart, but that killed my site creation script midstream and aborted at the browser, so I needed something else.
    I tried a graceful restart of httpd, and while that allowed the site be available after creation, my script -- while it was running -- still couldn't access the site in order to execute a script on the new site (likely a DNS issue).
    So I figured maybe I could restart httpd gracefully (which would wait for my script to finish), but also restart named and that would allow my script to execute the other script on the new account.

    The combination of the following works for me:
    Code:
    apachectl -k graceful
    service named restart
    
    It allows my creation script to continue running, reloads named to get the new site's dns loaded so the creation script can call a script on the new site immediately, then reloads httpd gracefully after my script finishes.

    In my tests, the creation script ran to completion, the script it called on the new site ran properly during that process, and the browser can get to the new site without any trouble right after creation (unique subdomain, browser cache cleared, just to make sure it worked).

    So in my case, if this were to be changed inside cPanel, I would need a new account creation to not only issue a graceful restart of httpd, but also reload named. I can't see why you wouldn't *always* want to reload httpd and named immediately upon creation of a new account to make sure it's available right away.
     
  12. Seyed

    Seyed Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    skinak
    cPanel Access Level:
    Website Owner
    This problem is solved in
    Cpanel v70.0.41
     
  13. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    To update, this is solved in cPanel & WHM version 70.0.41 (as mentioned in the previous post):

    Fixed case CPANEL-20422: Ensure Apache is restart when install best certificate fails.

    This version is currently published to the CURRENT build tier, and should reach the RELEASE build tier soon. Can you let me know if the issue persists upon updating the affected system to this version?

    Thank you.
     
  14. Seyed

    Seyed Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    skinak
    cPanel Access Level:
    Website Owner
    hello @cPanelMichael

    Yes
    I upgraded v70.0.41 In the server that was having problems

    The problem has been resolved
     
    cPanelMichael likes this.
  15. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,245
    Likes Received:
    1,759
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    cPanel & WHM version 70.0.41 is now published to the RELEASE build tier.
     
  16. swbrains

    swbrains Well-Known Member

    Joined:
    Sep 13, 2006
    Messages:
    91
    Likes Received:
    7
    Trophy Points:
    158
    Thanks! I renamed my postwwwacct script to _postwwwacct and tested a new account creation and it ran fine and was available immediately.

    Thanks again for getting this fix implemented so quickly.
     
    cPanelMichael likes this.
Loading...

Share This Page