当我跑步时
sudo journalctl -u gunicorn
我得到:
Oct 14 12:49:22 my-server-thing systemd[1]: gunicorn.service: Failed to load environment files: Is a directory
Oct 14 12:49:22 my-server-thing systemd[1]: gunicorn.service: Failed to run 'start' task: Is a directory
Oct 14 12:49:22 my-server-thing systemd[1]: gunicorn.service: Failed with result 'resources'.
Oct 14 12:49:22 my-server-thing systemd[1]: Failed to start gunicorn daemon.
我认为我的目录中有些东西不对劲。我有/etc/systemd/system/gunicorn.service
:
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=myname
Group=myname
EnvironmentFile=/home/myname/myapp/env
WorkingDirectory=/home/myname/myapp
ExecStart=/home/myname/myapp/env/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
myapp.wsgi:application
[Install]
WantedBy=multi-user.target
The directories I’m working in are as follows.
myapp/
有我的 requirements.txt 文件、我的环境和另一个 app/ 目录。在 myapp/app 中,我有 manage.py 和另一个 app/ 环境。在 myapp/app/app 中,我有 settings.py 和 wsgi.py。
当我跑步时
nginx -t -c /etc/nginx/nginx.conf
我明白了
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2020/10/15 10:32:57 [warn] 31742#31742: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
2020/10/15 10:32:57 [emerg] 31742#31742: unknown directive "mydomainname.co.uk" in /etc/nginx/conf.d/flaskapp.conf:3
nginx: configuration file /etc/nginx/nginx.conf test failed
我究竟做错了什么?
答案1
EnvironmentFile=/home/myname/myapp/env
应该是一个文件,而不是像有些人期望的那样是一个文件夹。
这里似乎存在 Web 项目和 systemd 之间的约定冲突。