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!

Setting up AutoSSL get 404 error

Discussion in 'Security' started by Uneschewed, May 23, 2019.

  1. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    Hello,

    I have created the file in my cPanel in the public_html called THE_TEXT_FILE.txt, but I get a 404 error when running
    Code:
    curl --user-agent "COMODO DCV" --insecure --max-time 10 --retry 0 http://mydomain.com/THE_TEXT_FILE.txt
    from the cli

    What do I set so that Comodo and Let's Encrypt can access the file THE_TEXT_FILE.txt.
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,262
    Likes Received:
    482
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @Uneschewed

    What do you get when you run that same command with the -vv flag?

    Code:
    curl -vv --user-agent "COMODO DCV" --insecure --max-time 10 --retry 0 http://mydomain.com/THE_TEXT_FILE.txt
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    I still get 404 I have DCV passthrough enabled.

    Do I need to whitelist the ip addresses for comodo and letsencrypt? If so, what are the ip addresses?
     
    #3 Uneschewed, May 23, 2019
    Last edited by a moderator: May 23, 2019
  4. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    I have whitelisted the ip addresses on my server, but still getting 404 not found reported from autossl.
     
  5. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,262
    Likes Received:
    482
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Just to be sure, did you create the file with the ownership of the account or as root?

    If you're getting a 404 on the text file manually, you'll definitely continue to get it with AutoSSL

    Do you have anything in the .htaccess file for that domain?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    I created the file using cPanel File Manager as my account. I have an .htaccess but it worked for AutoSSL before.
     
  7. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,262
    Likes Received:
    482
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    I'm looking for what specifically is in the .htaccess file here. In some cases a plugin could have added entries or there could be something causing the txt file not to be able to be read.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    I have the following information in the mod rewrite:

    Code:
    <IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
    # Disable Apache MultiViews since it
    # may conflict with the GUI installer
    Options -Indexes -MultiViews
    </IfModule>
    RewriteEngine On
    # BEGIN Redirect to https / SSL
    #RewriteCond %{HTTPS} !on
    #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    #RewriteCond %{HTTPS} off
    #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    # END Redirect to https / SSL
    # Redirect Trailing Slashes If Not A Folder...
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule ^(.*)/$ /$1 [L,R=301]
    # Handle Front Controller... redirect directroy or folder that does not exist to index
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
    # Redirect subdomains that dont exist
    
    # Set rediret for addon domain subdomain in cPanel Redirects
    # Set redirect for addon domain subdomain folder
    Redirect 301 /example1.com https://www.example.com/index.php
    Redirect 301 /example.org https://www.example.com/index.php
    Redirect 301 /example.church https://www.example.com/index.php
    Redirect 301 /example2.com https://www.example.com/index.php
    Redirect 301 /example.tube https://www.example.com/index.php
    
    # Set redirect
    RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$ [NC]
    RewriteRule ^ https://example.com/ [L,R]
    RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$ [NC]
    RewriteRule ^ https://example.com/ [L,R]
    RewriteCond %{HTTP_HOST} ^(.+)\.example\.org$ [NC]
    RewriteRule ^ https://example.org/ [L,R]
    RewriteCond %{HTTP_HOST} ^(.+)\.example\.gold$ [NC]
    RewriteRule ^ https://example.gold/ [L,R]
    RewriteCond %{HTTP_HOST} ^(.+)\.example\.church$ [NC]
    RewriteRule ^ https://example.church/ [L,R]
    RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$ [NC]
    RewriteRule ^ https://example.com/ [L,R]
    RewriteCond %{HTTP_HOST} ^(.+)\.example\.tube$ [NC]
    RewriteRule ^ https://example.tube/ [L,R]
    
    # Redirect ONLY FOR MAIN DOMAIN example.com
    RewriteCond %{HTTP_HOST} ^[^.]+\.(example\.com)$ [NC]
    RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L,NE]
    
    # Use WebP
    # Does browser explicitly support webp?
    RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
    # OR Is request from Page Speed
    RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
    # OR does this browser explicitly support webp
    RewriteCond %{HTTP_ACCEPT} image/webp [OR]
    # AND does a webp image exists?
    RewriteCond %{DOCUMENT_ROOT}/$1\.webp -f
    # THEN send the webp image and set the env var webp
    RewriteRule (.+)\.(?:jpeg|png)$ $1.webp [NC,T=image/webp,E=webp,L]
    # If REDIRECT_webp env var exists, append Accept to the Vary header
    Header append Vary Accept env=REDIRECT_webp
    
    </IfModule>
     
     
    Mod note, post edited. Please review:
    Guide To Opening An Effective Forums Thread
     
    #8 Uneschewed, May 24, 2019
    Last edited by a moderator: May 24, 2019
  9. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    I have read the guide throughly and will follow its decree.
     
  10. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    May we continue the estimate Houston? I would like to setup my domains, as part of the problem I am having is that my main domain is redirecting to the following:

    mydomain.com/cgi-sys/defaultwebpage.cgi
     
  11. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    I also just set up the server.

    My configuration is as follows:

    Code:
    /etc/redhat-release:CentOS Linux release 7.6.1810 (Core)
    /usr/local/cpanel/version:11.78.0.24
    /var/cpanel/envtype:xen hvm
    CPANEL=release
     
  12. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    I have already ran the following commands:

    Code:
    sudo /scripts/install_lets_encrypt_autossl_provider
    sudo /scripts/rebuildhttpdconf
    sudo service httpd restart
    What is the next step to make AutoSSL work with Comodo and LetsEncypt and make the domain no longer redirect to mydomain.com/cgi-sys/defaultwebpage.cgi and fix the 404 error for the text file stored at my root public_html folder when using the following command at Linux CLI?

    Code:
    curl --user-agent "COMODO DCV" --insecure --max-time 10 --retry 0 http://mydomain.com/THE_TEXT_FILE.txt
     
  13. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,262
    Likes Received:
    482
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Can you temporarily move/rename the .htaccess file, there's a lot of redirects there and I'd like to rule out the .htaccess for both the default page and 404 issues with AutoSSL.

    Once it's renamed try running the AutoSSL check once more and/or clearing the browser's cache and viewing the page.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    I deleted the .htaccess file and ran the AutoSSL in cPanel, then I tried clearing browser cache and then ran AutoSSL again. The result is that the txt file I created in the root of the public_html directory shows a 404 on browser, 404 in curl on Linux CLI, and the temporary file AutoSSL tries to create also shows a 404 which is displayed in cPanel SSL/TLS Status.
     
  15. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,262
    Likes Received:
    482
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Can you please open a ticket using the link in my signature? Once open please reply with the Ticket ID here so that we can update this thread with the resolution once the ticket is resolved.


    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. Uneschewed

    Uneschewed Member

    Joined:
    May 13, 2019
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Missouri
    cPanel Access Level:
    Root Administrator
    I have created a support ticket and the ticket number is 12433641.
     
  17. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,262
    Likes Received:
    482
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @Uneschewed

    Great, I'm following that ticket and I'll update here with the outcome, I do see someone is already working with you on it as well.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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