After repeating the process to try to install in another domain, the site goes out of the failed

I install certificate using this tutorial:https://sridhar.blog/install-ssl-certificate-serverpilot-managed-hosting-account/
the first time, he work normal with cesarpeixoto.com, and secud time i try install certifica in subdomain phpmyadmin.cesarpeixoto.com and repeting the step 5 of tutorial > :https://sridhar.blog/install-ssl-certificate-serverpilot-managed-hosting-account/ for rum sple.sh and in finish this server not work more.
My domain is:
cesarpeixoto.com

I ran this command:
Step 5 and add appname and domain
https://sridhar.blog/install-ssl-certificate-serverpilot-managed-hosting-account/
It produced this output:
in first tentative, i add appname and not display screen of terms pass directy for finali. And secound tentative i add the appname that before work normal. And output this:

i have two domainsub with diferent diredory >appname
www.phpmyadmin.cesarpeixoto.com
phpmyadmin.cesarpeixoto.com

My web server is (include version):
i use vultr with serverpilot
Ubuntu 16.04 x64

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know):
Sim, i have root acess

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
Serverpilot

Hi @BarbaraEster

but there are no A- or AAAA-records. If you want to create a certificate, you must use http-01 - challenge (webserver and a file) or dns-01 - challenge (new dns-entry).

The script uses http-01, so you need an A- or AAAA - record (+ webserver).

The config of domain is this: https://i.imgur.com/27G5sRb.png

and cesarpeixoto.com was working before. Only stopped after I re-did the operation for other domains.

see this site not work> https://i.imgur.com/wBmdE4M.png

before of try install in subdomain, he work >

i try restart ngix and he not work i get this error:

IO_new_file("/etc/letsencrypt/live/phpmyadmin.cesarpeixoto.com/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(’/etc/letsencrypt/live/phpmyadmin.cesarpeixoto.com/fullchain.pem’,‘r’) error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx-sp/nginx.conf test failed

I did not understood the cause.

Hi @BarbaraEster,

I just took a look at the sple.sh tool by Rudy Affandi that you used, and one problem that I think is related to your situation is that it doesn’t seem to check whether the certificate was issued successfully before trying to configure nginx to use it. Immediately after trying to obtain a certificate, it assumes that the certificate exists and creates an nginx configuration pointed at that certificate!

However, it appears that your certificate has not been issued at all

https://crt.sh/?Identity=%phpmyadmin.cesarpeixoto.com&iCAID=16418

So, that probably explains why nginx now has trouble running on your system. I think this is a flaw in sple.sh because it will leave your nginx in a broken state like this if any problem occurs when requesting the certificate.

Do you have a copy of the output that appeared when you ran sple.sh, or do you remember whether it reported any particular error?

Também falo português, caso isso ajudar.

Oi Obrigado pela ajuda! ajuda sim rsrs
Então quando executei o sple.sh pela primeira vez ele funcionou normal somente com o domínio cesarpeixoto.com, como queria add os subdomínios também eu executei novamente o sple.sh ele pediu as credenciais e logo apos executou mas nao vi nada de diferente. Quando terminou o site ja estava fora do ar. Depois tentando arrumar executei novamente o sple.sh e tentei inserir os subdomínios junto ao domínio principal. e reportou o erro acima de que os subdomínios não foi encontrado. O que posso fazer agora pra reverter esse problema? :confused:

Achei esses comandos:https://github.com/lesaff/serverpilot-letsencrypt
e segui o local de log, talvez isso ajude.

no local de log eu tenho:

    2018-06-29 12:00:03,439:DEBUG:letsencrypt.cli:Root logging level set at 30
2018-06-29 12:00:03,441:INFO:letsencrypt.cli:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2018-06-29 12:00:03,442:DEBUG:letsencrypt.cli:letsencrypt version: 0.4.1
2018-06-29 12:00:03,442:DEBUG:letsencrypt.cli:Arguments: []
2018-06-29 12:00:03,443:DEBUG:letsencrypt.cli:Discovered plugins: PluginsRegistry(PluginEntryPoint#webroot,PluginEntryPoint#null,PluginEntryPoint#manual,PluginEntryPoint#standalone)
2018-06-29 12:00:03,457:DEBUG:letsencrypt.cli:Requested authenticator  and installer 
2018-06-29 12:00:03,457:DEBUG:letsencrypt.cli:Default Detector is Namespace(account='', agree_dev_preview=None, apache='', authenticator='', break_my_certs='', cert_path='/root', chain_path=None, checkpoints=0, config_dir='', config_file=None, configurator='', csr='', debug='', domains=[], dry_run='', duplicate='', email='', expand='', fullchain_path=None, func=<function renew at 0x7f75d3a65d70>, hsts=False, http01_port=0, ifaces='', init='', installer='', key_path='/root', logs_dir='', manual='', manual_public_ip_logging_ok=False, manual_test_mode=False, nginx='', no_self_upgrade='', no_verify_ssl=False, noninteractive_mode='', os_packages_only='', prepare='', redirect=None, register_unsafely_without_email='', reinstall='', renew_by_default='', rsa_key_size=0, server='', staging='', standalone='', standalone_supported_challenges='tls-sni-01,http-01', store_false_vars={'--no-uir': True, <letsencrypt.cli.HelpfulArgumentParser object at 0x7f75d3575510>: True, '--no-redirect': True, '--no-hsts': True}, strict_permissions='', text_mode='', tls_sni_01_port=0, tos='', uir=None, user_agent=None, verb='renew', verbose_count=0, version='', webroot='', webroot_map={}, webroot_path=[], work_dir='')
2018-06-29 12:00:03,468:DEBUG:parsedatetime:parse (top of loop): [30 days][]
2018-06-29 12:00:03,470:DEBUG:parsedatetime:CRE_UNITS matched
2018-06-29 12:00:03,471:DEBUG:parsedatetime:parse (bottom) [][30 days][][]
2018-06-29 12:00:03,471:DEBUG:parsedatetime:weekday False, dateStd False, dateStr False, time False, timeStr False, meridian False
2018-06-29 12:00:03,471:DEBUG:parsedatetime:dayStr False, modifier False, modifier2 False, units True, qunits False
2018-06-29 12:00:03,471:DEBUG:parsedatetime:_evalString(30 days, time.struct_time(tm_year=2018, tm_mon=6, tm_mday=29, tm_hour=12, tm_min=0, tm_sec=3, tm_wday=4, tm_yday=180, tm_isdst=0))
2018-06-29 12:00:03,471:DEBUG:parsedatetime:_buildTime: [30 ][][days]
2018-06-29 12:00:03,471:DEBUG:parsedatetime:units days --> realunit days
2018-06-29 12:00:03,471:DEBUG:parsedatetime:return
2018-06-29 12:00:03,471:INFO:letsencrypt.cli:Cert not yet due for renewal
2018-06-29 12:00:03,471:DEBUG:letsencrypt.cli:no renewal failures

Encontrei esse log no momento quando deu errado. Depois tem outros mas o site ja estava fora do ar esse foi o primeiro:

Outro log:

Consegui arrumar! xD

segui esse passos

Check /var/log/letsencrypt for detailed error messages
ssh to your sp server as root
cd /etc/nginx-sp/vhosts.d
List all the ssl config files
ls ssl
Delete the .ssl.conf that is causing problem
Restart nginx sudo service nginx-sp restart

Deletei todos e depois disso o nginx voltou a funcionar.
Uma duvida agora seria quando cadastrei o domínio e tentei por o subdomínio como eu faço isso?

Muito Obrigado!

Ele nao consegue criar novamente. da o mesmo erro. Como faço para criar outro?
Fui criar novamente e apareceu isso aqui:



Domain: www.phpmyadmin.cesarpeixoto.com
Type: dns
Detail: DNS problem: NXDOMAIN looking up A for www.phpmyadmin.cesarpeixoto.com

Now

phpmyadmin.cesarpeixoto.com

has a valid ip-address 45.63.21.115

But

www.phpmyadmin.cesarpeixoto.com

has no ip-address. Add a dns-entry www.phpmyadmin

Agora há muito que aconteceu enquanto eu dormia. :slight_smile:

Uma coisa que pode ser relevante é que você tem duas versões do Certbot. Recebeu uma executando certbot-auto atráves do script sple.sh, e aparentemente outra seguindo os passos de outro tutorial.

As duas versões são muito diferentes, e a de certbot-auto (porque auto-atualiza sempre!) é muito mais recente. Pode tentar de novo com certbot-auto em vez do certbot ou letsencrypt no tutorial? (Ao executá-lo, precisará especificar o diretório onde baixou certbot-auto, porque não faz parte do seu PATH.)

Se isso não resolver o problema, pode me dar um resumo da situação, seus problemas atuais, e o que ainda precisa fazer?

is right! i dont see that www. not config. Thanks!

Blz vou tentar… como examante faço isso usando o certbot-auto? eu só tentei o tutorial pra executar o sple.sh. tem algum tutorial que eu possa seguir pra entender melhor? Muito Obrigado!

Oi, obrigado pela ajuda, eu consegui arrumar seguindo esse tuto:

Eu instalei esse certbot… e o arquivo .ssl eu criei manualmente no diretório dele e inseri os nomes como mostra no arquivo ai no tutorial e uala funcionou no domínio cesarpeixoto. Que antes dava pau. Agora eu vou tentar adicionar no subdomínio.

Uma pergunta. Vou ter algum problema em instalar o certificado com o domínio em outro lugar e apontando para o ip de outro servidor no caso o vultr. Eu tenho os records A apontando para o IP do vultr e preciso instalar o certificado nesse domínio. Eu vou ter problemas?

Obrigado!

Que bom que conseguiu. Geralmente o Certbot oferece uma opção bem mais fácil na qual ele cria o arquivo de configuração, como

certbot-auto --nginx

Nesse caso o Certbot vai criar o arquivo de configuração do nginx, baseado num arquivo já existente que configura o mesmo site em HTTP (sem HTTPS). Entretanto (1) você já precisaria ter uma configuração pelo site em HTTP, que talvez não tenha, e (2) talvez há alguma dificuldade com o ServerPilot devido à qual precisa criar esse arquivo manualmente.

Now

http://www.phpmyadmin.cesarpeixoto.com/

is working. But

https://www.phpmyadmin.cesarpeixoto.com/

has the wrong certificate, only cesarpeixoto.com, www.cesarpeixoto.com

Now you should use something like

./certbot-auto certonly --standalone -d cesarpeixoto.com -d www.cesarpeixoto.com -d phpmyadmin.cesarpeixoto.com -d www.phpmyadmin.cesarpeixoto.com

so you get one certificate with four names.

O certificado não menciona o endereço IP, assim você pode usá-lo (com a chave privada correspondente) em qualquer máquina.

Mas é importante se lembrar de que o certificado tem um prazo de apenas 90 dias. Nos últimos passos do tutorial que você seguiu prevê a emissão e instalação (automáticas) de novos certificados antes do vencimento do certificado. Para nós isso é importante para tornar o uso da Let's Encrypt conveniente para o usuário, já que ter que repetir todos os passos a cada três meses seria bastante chato.

Copiando apenas os certificados para outro servidor, essa parte de renovação automática provavelmente não vai dar certo. (Pelo menos, precisaria copiar todo o conteúdo de /etc/letsencrypt, com a estrutura dos symlinks, para que o Certbot saiba fazer a renovação do certicado no outro servidor.)

Já que escrevi tudo isso, acho que talvez entendi a dúvida de forma errada e respondi outra pergunta. :slight_smile: Sua pergunta talvez não foi sobre copiar o certificado em outra máquina, mas sobre a emissão de certificados na máquina original enquanto um nome de domínio a ser incluso nos novos certificados apontar para outra máquina?