<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<span style="font-family: helvetica,arial,sans-serif;">Ne že bych
znal nginx nějak dobře, ale přijde mi divné, že by sám od sebe bez
vnějšího povelu najednou 23:40 restartoval. A jinak nechápu proč
by dělal znovu listen. Klidně to může být nějaký posthook na
certbotu (ale ten to snad dělá jenom když je nový certifikát,
ne?). Koukni taky na log CRONu nebo také máš systemd, tak ten má
taky nějaké naplánované úlohy. <br>
<br>
Přijde mi to, jak kdyby se pustil nějaký restart, starý proces se
nestihl z nějakého důvodu ukončit a už se startoval nový. Je nad
tímhle záznamem ještě něco dalšího velmi blízko (< 2min) před
tímto časem?<br>
<br>
Neboli - prošel bych všechny systémové logy a podíval se co se
dělo okolo času 23:40 a pokusil se zjistit příčinu restart nginx.<br>
<br>
Š.<br>
</span>
<div class="moz-cite-prefix">Dne 14. 10. 20 v 8:48
<a class="moz-txt-link-abbreviated" href="mailto:petr.bolf@taborpolana.cz">petr.bolf@taborpolana.cz</a> napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:bf1a159b-734d-251b-7436-daa585f9f963@taborpolana.cz">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p><br>
</p>
<p><br>
</p>
<p>sudo netstat -luntp | grep "80\|443"</p>
<p><br>
</p>
<p>nic tam neběží na těch portech.</p>
<p>Server jsem spustil v cca 16 hod a ve 23.40 to spadlo. To se do
toho musí motat nějaký další program, možná by mohl být vinník
certbot, nebo nějaké nastavení v cronu? Ale nic podezřelého
nevidím.<br>
</p>
<p>sudo tail -f /var/log/nginx/error.log.1 <br>
2020/10/13 23:40:34 [emerg] 19730#19730: bind() to [::]:443
failed (98: Address already in use)<br>
2020/10/13 23:40:34 [emerg] 19730#19730: bind() to 0.0.0.0:443
failed (98: Address already in use)<br>
2020/10/13 23:40:34 [emerg] 19730#19730: bind() to 0.0.0.0:80
failed (98: Address already in use)<br>
2020/10/13 23:40:34 [emerg] 19730#19730: bind() to [::]:80
failed (98: Address already in use)<br>
2020/10/13 23:40:34 [emerg] 19730#19730: bind() to [::]:443
failed (98: Address already in use)<br>
2020/10/13 23:40:34 [emerg] 19730#19730: bind() to 0.0.0.0:443
failed (98: Address already in use)<br>
2020/10/13 23:40:34 [emerg] 19730#19730: bind() to 0.0.0.0:80
failed (98: Address already in use)<br>
2020/10/13 23:40:34 [emerg] 19730#19730: bind() to [::]:80
failed (98: Address already in use)<br>
2020/10/13 23:40:34 [emerg] 19730#19730: still could not bind()<br>
2020/10/13 23:40:37 [alert] 19672#19672: unlink()
"/run/nginx.pid" failed (2: No such file or directory)</p>
<p><br>
</p>
<p>sudo systemctl status nginx.service<br>
● nginx.service - A high performance web server and a reverse
proxy server<br>
Loaded: loaded (/lib/systemd/system/nginx.service; enabled;
vendor preset: en<br>
Active: failed (Result: exit-code) since Tue 2020-10-13
23:40:36 CEST; 8h ago<br>
Docs: <a class="moz-txt-link-freetext" href="man:nginx(8)"
moz-do-not-send="true">man:nginx(8)</a><br>
Process: 19729 ExecStartPre=/usr/sbin/nginx -t -q -g daemon
on; master_process<br>
Process: 19730 ExecStart=/usr/sbin/nginx -g daemon on;
master_process on; (cod<br>
<br>
Oct 13 23:40:35 domogled nginx[19730]: nginx: [emerg] bind() to
0.0.0.0:80 faile<br>
Oct 13 23:40:35 domogled nginx[19730]: nginx: [emerg] bind() to
[::]:80 failed (<br>
Oct 13 23:40:36 domogled nginx[19730]: nginx: [emerg] bind() to
[::]:443 failed <br>
Oct 13 23:40:36 domogled nginx[19730]: nginx: [emerg] bind() to
0.0.0.0:443 fail<br>
Oct 13 23:40:36 domogled nginx[19730]: nginx: [emerg] bind() to
0.0.0.0:80 faile<br>
Oct 13 23:40:36 domogled nginx[19730]: nginx: [emerg] bind() to
[::]:80 failed (<br>
Oct 13 23:40:36 domogled nginx[19730]: nginx: [emerg] still
could not bind()<br>
Oct 13 23:40:36 domogled systemd[1]: nginx.service: Control
process exited, code<br>
Oct 13 23:40:36 domogled systemd[1]: nginx.service: Failed with
result 'exit-cod<br>
Oct 13 23:40:37 domogled systemd[1]: Failed to start A high
performance web serv<br>
lines 1-17/17 (END)<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Dne 13. 10. 20 v 17:15 Jan Pleva
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:CAC+s-MLYNhEfm30-FeHA5SJyPRiy8-ZL9ckXWTChEp17Z9nX1g@mail.gmail.com">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<div dir="ltr">no, nabehne... prave ze nenabehne... pokud tam
ten web bezi v mezicase, pak je dost mozna problem v tom, ze
bud tam bezi jiny webserver, nebo nejaka druha instance nginxu
o ketere ten start script nevi. Tak nebo onak, nginx se nemuze
poslouchat na 80/443 protoze uz na tom portu neco jineho
posloucha. At uz nginx, Apache nebo neco jineho.
<div><br>
</div>
<div>Jak pise kolega, <font face="monospace"><i>netstat
-luntp | grep "80\|443"</i></font> by melo vnest svetlo
odkud vitr fouka. <br clear="all">
<div>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature"> <br>
S pozdravem<br>
<br>
Jan Pleva</div>
</div>
<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">út 13. 10. 2020 v 16:03
odesílatel <a href="mailto:petr.bolf@taborpolana.cz"
moz-do-not-send="true">petr.bolf@taborpolana.cz</a> <<a
href="mailto:petr.bolf@taborpolana.cz"
moz-do-not-send="true">petr.bolf@taborpolana.cz</a>>
napsal:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">dík<br>
<br>
<br>
Mate mne, že server naběhne, nginx -t je spokojený a chyba
se projeví až <br>
po nějakém čase. Zatím se mi zdá, že jsem měl bordel v
jednom <br>
konfiguráku a jakoby to tam udělal certbot, a nebo se tam
něco omylem <br>
zkopírovalo.<br>
<br>
<br>
Když jsem měl chybu v konfiguraci serveru, většinou se to
projevilo už <br>
při startu, nebo při nginx -t.<br>
<br>
<br>
<br>
Petr<br>
<br>
Dne 13. 10. 20 v 15:31 Vojtěch Oram napsal(a):<br>
> Ahoj,<br>
> neběží tim tam třeba ještě Apache? Vypadá to, že Nginx
nemůže <br>
> nastartovat, protože jsou porty 80 a 443 už obsazené.
Zkus se kouknout <br>
> na výstup "netstat -nlp", co tam běží na portu 80 a
443.<br>
><br>
> S přáním pěkného dne<br>
><br>
> Vojtěch "Flaiming" Oram<br>
> <a href="https://vojtechoram.cz" rel="noreferrer"
target="_blank" moz-do-not-send="true">https://vojtechoram.cz</a><br>
><br>
> Dne 13. 10. 20 v 14:57 <a
href="mailto:petr.bolf@taborpolana.cz" target="_blank"
moz-do-not-send="true">petr.bolf@taborpolana.cz</a>
napsal(a):<br>
>> zdravím,<br>
>><br>
>><br>
>> nevěděl by někdo s čím může být problém - asi někde
v konfiguraci <br>
>> serverů pro nginx.<br>
>><br>
>> sudo nginx -t<br>
>> nginx: the configuration file /etc/nginx/nginx.conf
syntax is ok<br>
>> nginx: configuration file /etc/nginx/nginx.conf
test is successful<br>
>><br>
>><br>
>> sudo systemctl start nginx.service<br>
>><br>
>> sudo systemctl status nginx.service<br>
>> ● nginx.service - A high performance web server and
a reverse proxy <br>
>> server<br>
>> Loaded: loaded
(/lib/systemd/system/nginx.service; enabled; vendor <br>
>> preset: en<br>
>> Active: active (running) since Tue 2020-10-13
14:49:08 CEST; 6min ago<br>
>> Docs: <a class="moz-txt-link-freetext"
href="man:nginx(8)" moz-do-not-send="true">man:nginx(8)</a><br>
>> Process: 16277 ExecStartPre=/usr/sbin/nginx -t -q
-g daemon on; <br>
>> master_process<br>
>> Process: 16278 ExecStart=/usr/sbin/nginx -g
daemon on; <br>
>> master_process on; (cod<br>
>> Main PID: 16279 (nginx)<br>
>> Memory: 21.0M<br>
>> CGroup: /system.slice/nginx.service<br>
>> ├─16279 nginx: master process
/usr/sbin/nginx -g daemon <br>
>> on; master_pr<br>
>> ├─16280 nginx: worker process<br>
>> ├─16281 nginx: worker process<br>
>> ├─16282 nginx: worker process<br>
>> ├─16283 nginx: worker process<br>
>> ├─16284 nginx: worker process<br>
>> ├─16285 nginx: worker process<br>
>> ├─16286 nginx: worker process<br>
>> └─16287 nginx: worker process<br>
>><br>
>><br>
>> jenže po nějakém čase server spadne.<br>
>><br>
>><br>
>> sudo tail -f /var/log/nginx/error.log<br>
>> 2020/10/13 02:39:01 [emerg] 7506#7506: bind() to
[::]:443 failed (98: <br>
>> Address already in use)<br>
>> 2020/10/13 02:39:01 [emerg] 7506#7506: bind() to <a
href="http://0.0.0.0:443" rel="noreferrer" target="_blank"
moz-do-not-send="true">0.0.0.0:443</a> failed <br>
>> (98: Address already in use)<br>
>> 2020/10/13 02:39:01 [emerg] 7506#7506: bind() to <a
href="http://0.0.0.0:80" rel="noreferrer" target="_blank"
moz-do-not-send="true">0.0.0.0:80</a> failed <br>
>> (98: Address already in use)<br>
>> 2020/10/13 02:39:01 [emerg] 7506#7506: bind() to
[::]:80 failed (98: <br>
>> Address already in use)<br>
>> 2020/10/13 02:39:01 [emerg] 7506#7506: bind() to
[::]:443 failed (98: <br>
>> Address already in use)<br>
>> 2020/10/13 02:39:01 [emerg] 7506#7506: bind() to <a
href="http://0.0.0.0:443" rel="noreferrer" target="_blank"
moz-do-not-send="true">0.0.0.0:443</a> failed <br>
>> (98: Address already in use)<br>
>> 2020/10/13 02:39:01 [emerg] 7506#7506: bind() to <a
href="http://0.0.0.0:80" rel="noreferrer" target="_blank"
moz-do-not-send="true">0.0.0.0:80</a> failed <br>
>> (98: Address already in use)<br>
>> 2020/10/13 02:39:01 [emerg] 7506#7506: bind() to
[::]:80 failed (98: <br>
>> Address already in use)<br>
>> 2020/10/13 02:39:01 [emerg] 7506#7506: still could
not bind()<br>
>> 2020/10/13 02:39:04 [alert] 7357#7357: unlink()
"/run/nginx.pid" <br>
>> failed (2: No such file or directory)<br>
>><br>
>><br>
>> a když je spadlý tak<br>
>><br>
>><br>
>> sudo systemctl status nginx.service<br>
>> [sudo] password for pruga:<br>
>> ● nginx.service - A high performance web server and
a reverse proxy <br>
>> server<br>
>> Loaded: loaded
(/lib/systemd/system/nginx.service; enabled; vendor <br>
>> preset: en<br>
>> Active: failed (Result: exit-code) since Tue
2020-10-13 02:39:04 <br>
>> CEST; 11h ag<br>
>> Docs: <a class="moz-txt-link-freetext"
href="man:nginx(8)" moz-do-not-send="true">man:nginx(8)</a><br>
>> Process: 7501 ExecStartPre=/usr/sbin/nginx -t -q
-g daemon on; <br>
>> master_process<br>
>> Process: 7506 ExecStart=/usr/sbin/nginx -g daemon
on; <br>
>> master_process on; (code<br>
>><br>
>> Oct 13 02:39:03 domogled nginx[7506]: nginx:
[emerg] bind() to <br>
>> <a href="http://0.0.0.0:80" rel="noreferrer"
target="_blank" moz-do-not-send="true">0.0.0.0:80</a>
failed<br>
>> Oct 13 02:39:03 domogled nginx[7506]: nginx:
[emerg] bind() to <br>
>> [::]:80 failed (9<br>
>> Oct 13 02:39:03 domogled nginx[7506]: nginx:
[emerg] bind() to <br>
>> [::]:443 failed (<br>
>> Oct 13 02:39:03 domogled nginx[7506]: nginx:
[emerg] bind() to <br>
>> <a href="http://0.0.0.0:443" rel="noreferrer"
target="_blank" moz-do-not-send="true">0.0.0.0:443</a>
faile<br>
>> Oct 13 02:39:03 domogled nginx[7506]: nginx:
[emerg] bind() to <br>
>> <a href="http://0.0.0.0:80" rel="noreferrer"
target="_blank" moz-do-not-send="true">0.0.0.0:80</a>
failed<br>
>> Oct 13 02:39:03 domogled nginx[7506]: nginx:
[emerg] bind() to <br>
>> [::]:80 failed (9<br>
>> Oct 13 02:39:04 domogled nginx[7506]: nginx:
[emerg] still could not <br>
>> bind()<br>
>> Oct 13 02:39:04 domogled systemd[1]: nginx.service:
Control process <br>
>> exited, code<br>
>> Oct 13 02:39:04 domogled systemd[1]: nginx.service:
Failed with <br>
>> result 'exit-cod<br>
>> Oct 13 02:39:04 domogled systemd[1]: Failed to
start A high <br>
>> performance web serv<br>
>><br>
>><br>
>> přičemž<br>
>><br>
>> sudo systemctl start nginx.service<br>
>><br>
>><br>
>> ho zase nastartuje a zase chvilu běží.<br>
>><br>
>><br>
>> díky<br>
>><br>
>><br>
>> Petr Bolf<br>
>><br>
>> _______________________________________________<br>
>> Community-list mailing list<br>
>> <a href="mailto:Community-list@lists.vpsfree.cz"
target="_blank" moz-do-not-send="true">Community-list@lists.vpsfree.cz</a><br>
>> <a
href="http://lists.vpsfree.cz/listinfo/community-list"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.vpsfree.cz/listinfo/community-list</a><br>
> _______________________________________________<br>
> Community-list mailing list<br>
> <a href="mailto:Community-list@lists.vpsfree.cz"
target="_blank" moz-do-not-send="true">Community-list@lists.vpsfree.cz</a><br>
> <a
href="http://lists.vpsfree.cz/listinfo/community-list"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.vpsfree.cz/listinfo/community-list</a><br>
_______________________________________________<br>
Community-list mailing list<br>
<a href="mailto:Community-list@lists.vpsfree.cz"
target="_blank" moz-do-not-send="true">Community-list@lists.vpsfree.cz</a><br>
<a href="http://lists.vpsfree.cz/listinfo/community-list"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.vpsfree.cz/listinfo/community-list</a><br>
</blockquote>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Community-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Community-list@lists.vpsfree.cz" moz-do-not-send="true">Community-list@lists.vpsfree.cz</a>
<a class="moz-txt-link-freetext" href="http://lists.vpsfree.cz/listinfo/community-list" moz-do-not-send="true">http://lists.vpsfree.cz/listinfo/community-list</a>
</pre>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Community-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Community-list@lists.vpsfree.cz">Community-list@lists.vpsfree.cz</a>
<a class="moz-txt-link-freetext" href="http://lists.vpsfree.cz/listinfo/community-list">http://lists.vpsfree.cz/listinfo/community-list</a>
</pre>
</blockquote>
<br>
</body>
</html>