nginx иногда останавливается - PullRequest
0 голосов
/ 20 мая 2018

Мой nginx на виртуальной машине останавливается, и я не могу выяснить причину.

sudo nginx -t -c /etc/nginx/nginx.conf

возвращает

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Также есть некоторые журналы:

sudo systemctl status nginx.service

журналы:

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2018-05-20 12:26:38 UTC; 2h 34min ago
  Process: 25083 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 25126 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 25123 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 6426 (code=exited, status=0/SUCCESS)

May 20 12:26:37 sl-code nginx[25126]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
May 20 12:26:37 sl-code nginx[25126]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
May 20 12:26:38 sl-code nginx[25126]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
May 20 12:26:38 sl-code nginx[25126]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
May 20 12:26:38 sl-code nginx[25126]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
May 20 12:26:38 sl-code nginx[25126]: nginx: [emerg] still could not bind()
May 20 12:26:38 sl-code systemd[1]: nginx.service: Control process exited, code=exited status=1
May 20 12:26:38 sl-code systemd[1]: Failed to start A high performance web server and a reverse proxy server.
May 20 12:26:38 sl-code systemd[1]: nginx.service: Unit entered failed state.
May 20 12:26:38 sl-code systemd[1]: nginx.service: Failed with result 'exit-code'.

1 Ответ

0 голосов
/ 20 мая 2018

Кажется, что у вас запущен другой веб-сервер.Попробуйте остановить все остальные процессы веб-сервера и перезапустите nginx

...