2017-05-08 1 views
1

저는 django 응용 프로그램을 실행하는 nginx 및 gunicorn으로 데비안 웹 서버를 실행하고 있습니다. 나는 모든 것을 가지고 있고 정상적으로 작동하지만 서버를 재부팅 한 후에 나는 502 불량 게이트웨이 오류가 발생한다. 재부팅 후 gunicorn이 비활성 상태 인 문제를 다시 추적했습니다. 서비스를 시작하면 서버를 다시 부팅 할 때까지 문제가 해결됩니다. 내 /etc/systemd/system/gunicorn.service 파일의부팅 후 gunicorn이 시작되지 않습니다.

{username}@instance-3:~$ sudo systemctl status gunicorn 
● gunicorn.service - gunicorn daemon 
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled) 
Active: inactive (dead) 

내용 :

재부팅이 여기 내 gunicorn 서비스 상태 후

systemctl start gunicorn.service 

:

서비스 시작

[Unit] 
Description=gunicorn daemon 
After=network.target 

[Service] 
User={username} 
Group={username} 
WorkingDirectory=/home/{username}/web/{projname} 
ExecStart=/usr/local/bin/gunicorn {projname}.wsgi:application 
Restart=on-failure 

[Install] 
WantedBy=multi.user.target 

재부팅 후 왜 gunicorn 서비스가 시작되지 않는지 알아 내려고하는 아이디어가 있습니까?

편집 :

문제가 gunicorn.conf가 CHDIR에서 다른 디렉토리와 작업 디렉토리보다 간부을 가지고있을 수 있을까요?

{username}@instance-3:~$ cat /etc/init/gunicorn.conf 
cription "Gunicorn application server handling {projname}" 

start on runlevel [2345] 
stop on runlevel [!2345] 

respawn 
setuid {username} 
setgid {username} 
chdir /home/data-reporting/draco_reporting 

exec {projname}/bin/gunicorn --workers 3 --bind unix:/home/{username}/data-reporting/{projname}/{projname}.sock {projname}.wsgi:application 

답변

1

gunicorn.service 파일에 작은 오타가 있습니다.

Restart=always 
+1

편집 : 또한

WantedBy=multi-user.target 

, 당신은 변경 할 수 있습니다에 변경 내가 오타를 수정 한 후 gunicorn.service' 수 있도록 systemctl'-RAN을 다시 지금은 예상대로 작동합니다. 감사! – user1424311

관련 문제