我有一个非托管的 vps。我有 3 个 django 站点 sitename_dev、sitename_staging、sitename_live,它们使用虚拟环境运行。所有 3 个都是默认的 django 实例,没有进行任何更改。我已按如下方式配置了我的 apache。
在/etc/apache2/conf-available/wsgi.conf
#from virtual env
LoadModule wsgi_module "/path/to/virtualenv/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"
WSGIPythonHome "/path/to/virtualenv"
# dev site
Include /path/to/sitename_dev.conf
#staging
#Include /path/to/sitename_staging.conf
在path/to/sitename_dev.conf
WSGIScriptAlias /sitename_dev /path/to/sitename_dev/sitename_dev/wsgi.py
WSGIPythonPath /path/to/sitename_dev
<Directory /path/to/sitename_dev/sitename_dev>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
在path/to/sitename_staging.conf
WSGIScriptAlias /sitename_staging /path/to/sitename_staging/sitename_staging/wsgi.py
WSGIPythonPath /path/to/sitename_staging
<Directory /path/to/sitename_staging/sitename_staging>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
使用此配置我的.ip/站点名称_dev/打开。但是,如果我取消注释暂存站点行,将暂存站点包含在 /etc/apache2/conf-available/wsgi.conf 中,则my.ip/站点名称_dev和my.ip/站点名称_staging给出 500 错误。我怎样才能将 3 个站点作为子目录运行?
specs: OS: ubuntu 16.4 LTS server: apache2 2.4.18 python version of virtual env & wsgi: 3.6