Назад | Перейти на главную страницу

nginx выходит из строя, пока сайт каким-то образом все еще работает

Описание

Что я пробовал

● 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 Thu 2020-03-26 13:27:08 UTC; 13s ago
     Docs: man:nginx(8)
  Process: 11111 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 11111 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
 Main PID: 11111 (code=exited, status=0/SUCCESS)
nginx: [emerg] open() "/etc/nginx/sites-enabled/myproject" failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/sites-enabled/default:21
nginx: configuration file /etc/nginx/sites-enabled/default test failed

Статические файлы по-прежнему не загружаются, но nginx был исправлен с помощью следующих команд.

  • удаление случайно созданного файла myproject из /etc/nginx/sites-enabled/myproject какое имя файла указано в официальном руководстве, но the_actual_myproject имеет другое имя RUN:
cd /etc/nginx/sites-enabled
sudo rm myproject
  • БЕГАТЬ:
namei -l /run/gunicorn.sock
sudo systemctl restart gunicorn
sudo systemctl daemon-reload
sudo systemctl restart gunicorn.socket gunicorn.service
sudo nginx -t && sudo systemctl restart nginx
  • РЕЗУЛЬТАТ:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
  • БЕГАТЬ: 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: active (running) since Thu 2020-03-26 16:32:09 UTC; 7min ago
     Docs: man:nginx(8)
  Process: 11111 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, sta
  Process: 11111 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=ex
 Main PID: 11111 (nginx)
    Tasks: 2 (limit: 1152)
   CGroup: /system.slice/nginx.service