在 Debian 服务器上运行 Django 应用程序时,您应该创建某种应用程序用户(例如“myappuser”)并以该用户身份运行 gunicorn 进程还是可以/应该以 root 身份运行 gunicorn ?以 root 身份运行它会产生安全风险吗?我已经使用 APT 安装了 gunicorn,而不是将其安装在虚拟环境中。以应用程序用户身份运行它似乎会使配置更加困难,因为您必须授予该用户写入日志文件、PID 文件等的权限。以 root 身份运行它似乎更容易。
exec gunicorn $DJANGO_WSGI_MODULE:application \
--name myapp \
--user=$USER \ # <- who should this be?
--group=$GROUP \
Run Code Online (Sandbox Code Playgroud) 我想对服务器上的一些重要目录(例如 /etc/apache)进行版本控制。该目录中的所有文件和子目录都归 root:root 所有。为我的 root 用户创建公钥/私钥对,将该密钥添加到 Github 存储库,然后将该 apache 目录存储在 Github 上是否会被视为安全风险?如果存在安全风险,那么在 Github 上存储系统目录(而不是个人目录)的“最佳实践”方法是什么?
我有一个使用 Nginx 和 Gunicorn 的 Django 应用程序“djngxgun”。我刚刚安装了 Supervisor,以便我可以使用它来管理我的 Gunicorn 进程。问题是在我重新启动服务器后,Supervisor 没有启动 Gunicorn。当我通过主管启动 Gunicorn 时(“sudo supervisorctl start djngxgun”),我看到在我的 Gunicorn error.log 文件中重复出现以下错误:
2014-02-28 15:36:47 [4753] [INFO] Starting gunicorn 18.0
Traceback (most recent call last):
File "/home/djngxgun/venv/djngxgun/bin/gunicorn", line 9, in <module>
load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn')()
File "/home/djngxgun/venv/djngxgun/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 71, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/home/djngxgun/venv/djngxgun/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 143, in run
Arbiter(self).run()
File "/home/djngxgun/venv/djngxgun/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 172, in run
self.start()
File "/home/djngxgun/venv/djngxgun/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 124, in start
self.pidfile.create(self.pid)
File "/home/djngxgun/venv/djngxgun/local/lib/python2.7/site-packages/gunicorn/pidfile.py", line 38, in create
fd, fname = …
Run Code Online (Sandbox Code Playgroud) django ×2
gunicorn ×2
apache-2.2 ×1
debian ×1
github ×1
python ×1
security ×1
supervisord ×1
ubuntu ×1