Question

Problem with installing LetsEncrypt on Nginx Centos 7 after installing iRedMail

Posted May 7, 2017 3.8k views
NginxCentOSDigitalOceanLet's Encrypt

So I installed iRedMail for my mail server, after that I wanted to install LetsEncrypt but it gives me errors.

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: mail.placetoknow.com
   Type:   unauthorized
   Detail: Invalid response from
   http://mail.placetoknow.com/.well-known/acme-challenge/xZnfjqAedEiwkmbe2BWNWMT1ul-6MAyypleQOxeo3Ww:
   "<html>
   <head><title>404 Not Found</title></head>
   <body bgcolor="white">
   <center><h1>404 Not Found</h1></center>
   <hr><center>"

   Domain: app.placetoknow.com
   Type:   unauthorized
   Detail: Invalid response from
   http://app.placetoknow.com/.well-known/acme-challenge/C83_ljkYsC2Dfue6X4x0uK3ySZZS2k35X6vfAnC1oEY:
   "<html>
   <head><title>404 Not Found</title></head>
   <body bgcolor="white">
   <center><h1>404 Not Found</h1></center>
   <hr><center>"

   Domain: www.placetoknow.com
   Type:   unauthorized
   Detail: Invalid response from
   http://www.placetoknow.com/.well-known/acme-challenge/GT-feTfFHHlRYl6wgQsXve8ji9JxpveJbIKkW4M4VLo:
   "<html>
   <head><title>404 Not Found</title></head>
   <body bgcolor="white">
   <center><h1>404 Not Found</h1></center>
   <hr><center>"

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A record(s) for that domain
   contain(s) the right IP address.

I really don’t know how to solve this problems. Thank you in advance

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hi @Chempo

Can you post your Nginx server block?
It’s located in /etc/nginx/sites-enabled/[the name of your configuration].conf

  • hmmm weird, I dont have a folder named sites-enabled

    do I need to create it manually or what?

    • @Chempo Okay, then it’s not a default installation of Nginx. Check the bottom of the file /etc/nginx/nginx.conf to find a line starting with include, which should be a path of the directory where it reads the server blocks, but maybe the server blocks are simply all included in the nginx.conf file.

      • there are 2 of them in that file

        include /etc/nginx/conf.d/*.conf;
        include       /etc/nginx/mime.types;
        
        • Okay, then have a look in /etc/nginx/conf.d/.
          Didn’t know CentOS placed sites in that directory.

          • there is a file named default.conf

            here is the server block

            server {
                listen       80;
                server_name  placetoknow.com;
            
                location / {
                    root   /usr/share/nginx/html;
                    index  index.php index.html index.htm;
            try_files $uri $uri/ =404;
                }
            error_page 404 /404.html;
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                    root   /usr/share/nginx/html;
                }
                location ~ \.php$ {
                    try_files $uri =404;
                    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
                }
            }
            
            

@Chempo Okay, something is wrong, since the server-block you posted is for your root domain, but the errors in the first post lists 3 subdomains www mail app.

So somewhere there must be more Nginx configuration - if not, then you need to create the server-blocks for the other subdomains:
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-virtual-hosts-server-blocks-on-centos-6
Skip step 6 about creating a local hosts file.

by Etel Sverdlov
This tutorial shows you how to set up virtual hosts. Virtual Hosts are used to run more than one website or domain off of a single server and IP address. When used with nginx, virtual hosts are called Server Blocks. This tutorial covers setting up server blocks on a Centos server.
Submit an Answer