在 apache https 服务器中运行多个 django 应用程序,一个在 / 中,另一个在 /app2 中
我正在尝试在同一服务器 ssl 端口 443 中部署两个 django 应用程序。当我在第一个块中评论以下三行时,app2 正在运行,而在第二个块中注释时,app1 正在运行,并且当在两个块中取消注释时,两个应用程序都没有运行并显示内部服务器显示错误和 apache 错误日志
mod_wsgi (pid=48352): 无法执行 Python 脚本文件“/var/www/html/app1/app1/wsgi.py”。
WSGIDaemonProcess ......
WSGIProcessGroup ......
WSGIScriptAlias ......
我的 default.conf 文件 VirtualHost *:443 块如下,
Alias /static /var/www/html/app1/static
<Directory /var/www/html/app1/static>
Require all granted
</Directory>
<Directory /var/www/html/app1/app1>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess app1 python-path=/var/www/html/app1
WSGIProcessGroup app1
WSGIScriptAlias / /var/www/html/app1/app1/wsgi.py
Alias /museum/static /var/www/html/app2/static
<Directory /var/www/html/app2/static>
Require all granted
</Directory>
<Directory /var/www/html/app2/app2>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
#WSGIDaemonProcess app2 python-path=/var/www/html/app2
#WSGIProcessGroup app2
#WSGIScriptAlias /app2 /var/www/html/app2/app2/wsgi.py
对于上面的代码 app1 运行完美,
Alias /static /var/www/html/app1/static
<Directory /var/www/html/app1/static>
Require all granted
</Directory>
<Directory /var/www/html/app1/app1>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
#WSGIDaemonProcess app1 python-path=/var/www/html/app1
#WSGIProcessGroup app1
#WSGIScriptAlias / /var/www/html/app1/app1/wsgi.py
Alias /museum/static /var/www/html/app2/static
<Directory /var/www/html/app2/static>
Require all granted
</Directory>
<Directory /var/www/html/app2/app2>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess app2 python-path=/var/www/html/app2
WSGIProcessGroup app2
WSGIScriptAlias /app2 /var/www/html/app2/app2/wsgi.py
对于上面的代码 app2 运行完美,
我想同时运行两台服务器。
I am trying to deploy two django apps in same server ssl port 443. While I comment following three lines in first block app2 is running while commenting in second block app1 is running and when uncommenting in both block both apps is not running and showing Internal Server Error and apache error log showing
mod_wsgi (pid=48352): Failed to exec Python script file '/var/www/html/app1/app1/wsgi.py'.
WSGIDaemonProcess ......
WSGIProcessGroup ......
WSGIScriptAlias ......
my default.conf file VirtualHost *:443 block is as follows
Alias /static /var/www/html/app1/static
<Directory /var/www/html/app1/static>
Require all granted
</Directory>
<Directory /var/www/html/app1/app1>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess app1 python-path=/var/www/html/app1
WSGIProcessGroup app1
WSGIScriptAlias / /var/www/html/app1/app1/wsgi.py
Alias /museum/static /var/www/html/app2/static
<Directory /var/www/html/app2/static>
Require all granted
</Directory>
<Directory /var/www/html/app2/app2>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
#WSGIDaemonProcess app2 python-path=/var/www/html/app2
#WSGIProcessGroup app2
#WSGIScriptAlias /app2 /var/www/html/app2/app2/wsgi.py
for the above code app1 is running perfectly
Alias /static /var/www/html/app1/static
<Directory /var/www/html/app1/static>
Require all granted
</Directory>
<Directory /var/www/html/app1/app1>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
#WSGIDaemonProcess app1 python-path=/var/www/html/app1
#WSGIProcessGroup app1
#WSGIScriptAlias / /var/www/html/app1/app1/wsgi.py
Alias /museum/static /var/www/html/app2/static
<Directory /var/www/html/app2/static>
Require all granted
</Directory>
<Directory /var/www/html/app2/app2>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess app2 python-path=/var/www/html/app2
WSGIProcessGroup app2
WSGIScriptAlias /app2 /var/www/html/app2/app2/wsgi.py
for the above code app2 is running perfectly
I want to run both servers together.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您将每个应用程序放在 Apache 中的单独虚拟主机中,并进行重写以区分将哪个请求路由到哪个应用程序。
I would suggest you to put each app in an individual virtual host in Apache and do a rewrite to distinguish to which one to route which request.