Portál AbcLinuxu, 23. dubna 2024 19:06


Dotaz: Apache2 - Could not reliably determine the server's fully qualified domain name

31.10.2022 14:47 gepard
Apache2 - Could not reliably determine the server's fully qualified domain name
Přečteno: 242×
Odpovědět | Admin
Ahoj, mám problém s Apache.

"Could not reliably determine the server's fully qualified domain name, using 127.0.1.1.
Set the 'ServerName' directive globally to suppress this message"

Při použití self-signet certifikátu to nekřičí, ale když použiju jakýkoliv jiný doménový,
tak je problém. Píše mi to, že mám použít 'ServerName' globálně. Jak to udělám?

Ubuntu 22.04 server
Nástroje: Začni sledovat (0) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

31.10.2022 14:55 X
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Odpovědět | | Sbalit | Link | Blokovat | Admin
V ramci VirtualHostu?
31.10.2022 15:03 gepard
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Asi jo, mám tam: < VirtualHost _default_:443 >
Ruža Becelin avatar 31.10.2022 15:26 Ruža Becelin | skóre: 40 | blog: RuzaBecelinBlog
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Odpovědět | | Sbalit | Link | Blokovat | Admin
"Could not reliably determine the server's fully qualified domain name, using 127.0.1.1.

V /etc/hosts mu chybi radek s 127.0.1.1.

Jinak, jak pise, jde to nastavit pres ServerName.
Ruža Becelin avatar 31.10.2022 15:27 Ruža Becelin | skóre: 40 | blog: RuzaBecelinBlog
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
To ServerName je v httpd.conf /etc/apache2 nebo /etc/httpd, jde to i includovat pres externi soubor.
31.10.2022 15:58 gepard
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Nepomohlo, stále to samé.

/etc/hosts
127.0.0.1 localhost
127.0.1.1 moodle2 moodle tm-moodle

/etc/apache2/sites-available/moodle-ssl.conf
< IfModule mod_ssl.c>
. . . . . . . . < VirtualHost _default_:443>
. . . . . . . . ServerName tm-moodle
. . . . . . . . ServerAdmin webmaster@localhost
. . . . . . . . DocumentRoot /var/www/html/moodle
. . . . . . . . < /VirtualHost>
< /IfModule>
31.10.2022 16:54 X
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
ServerName tm-moodle
Kde je zbytek domeny? V ServerName ma byt FQDN = kompletni domena.
1.11.2022 08:40 gepard
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
I to jsem zkoušel, nepomohlo. Se self-signed certifikátem to takhle funguje...
Teď tam mám "ServerName tm-moodle.mojefirma.cz"
1.11.2022 09:42 Ptr
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Toto varování znamená, že nemáte nastavený ServerName globálně (tedy ne ve VirtualHostu, ale typicky někde v httpd.conf nebo apache2.conf, podle distribuce). Tam se to nastavuje pro případ, že přijde request, který nepasuje do žádného VirtualHostu. Mimochodem, že to jen informativní hláška, pokud něco nefunguje, tak máte chybu jinde.
1.11.2022 10:05 gepard
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Tak jsem mrknul do apache logu:

[Tue Nov 01 09:01:12.846072 2022] [ssl:emerg] [pid 3941] AH02562: Failed to configure certificate tm-moodle.mojefirma.cz:443:0 (with chain), check /etc/ssl/certs/tm-moodle.pem
[Tue Nov 01 09:01:12.846123 2022] [ssl:emerg] [pid 3941] SSL Library Error: error:0480006C:PEM routines::no start line (Expecting: TRUSTED CERTIFICATE) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Tue Nov 01 09:01:12.846133 2022] [ssl:emerg] [pid 3941] SSL Library Error: error:0A080009:SSL routines::PEM lib AH00016: Configuration Failed
1.11.2022 10:26 Ptr
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Něco je špatně s certifikátem - je ve špatném formátu (třeba je ve formátu DER místo PEM - musí to být textový soubor začínající -----BEGIN CERTIFICATE-----), nebo je poškozený (třeba windowsí konce řádků OpenSSL nesnese), nebo je tam nějaký nepořádek po konverzi (první řádek musí být -----BEGIN CERTIFICATE----- a nic víc) atd atd... Možností je opravdu hodně.
1.11.2022 10:34 gepard
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
(třeba windowsí konce řádků OpenSSL nesnese)
vyzkouším, to by mohlo být ono
1.11.2022 11:23 gepard
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Tak certifikát je ve formátu LF
1.11.2022 14:20 gepard
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Tak vyřešeno.

Dostal jsem k dispozici soubor mojefirma.pfx a špatně jsem si vygeneroval soubor mojefirma.key

Už to jede. Správný postup je toto:

openssl pkcs12 -in ./mojefirma.pfx -nocerts -out private.key
openssl pkcs12 -in ./mojefirma.pfx -clcerts -nokeys -out ./mojefirma.crt
openssl rsa -in ./private.key -out mojefirma.key
1.11.2022 14:39 gepard
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Měl jsem k dispozici i .pem a .key, ale to taky nejelo.
Musel jsem si to vygenerovat z toho .pfx
1.11.2022 09:45 Ptr
Rozbalit Rozbalit vše Re: Apache2 - Could not reliably determine the server's fully qualified domain name
Tady máte návod.

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.