Django和PHP在单一的IP和端口的服务器只在一起 [英] Django and PHP together in server with single ip and port only
问题描述
我能够在这样两种不同的端口上运行Django和PHP
http://pastebin.com/2eextGad
I am able to run django and php on two different ports like this http://pastebin.com/2eextGad
不过,我想是这样
54.22.22.22/app/到Django项目
54.22.22.22/app/ to django project
和比URL到PHP文件根目录以外的任何
在/ var / WWW /
and anything other than that url to PHP Document root /var/www/
我试图运行像
听8081
I tried running like Listen 8081
<VirtualHost *:8081>
WSGIScriptAlias /app/ /var/www/abc/index.wsgi
Alias /static/ /var/www/abc/static/
<Location "/static/">
Options -Indexes
</Location>
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Other than ip/app to php
Alias /var/www/
DocumentRoot /var/www
</VirtualHost>
如何做到这一点。
How to accomplish this
推荐答案
我认为这应该只是工作:
I think this should just work:
<VirtualHost *:8081>
WSGIScriptAlias /app/ /var/www/abc/index.wsgi
Alias /static/ /var/www/abc/static/
<Location "/static/">
Options -Indexes
</Location>
LogLevel warn
CustomLog /var/log/apache2/access.log combined
DocumentRoot /var/www
</VirtualHost>
这使得与 /应用/
开始从一个WSGI处理程序送达,地址与盯着地址/静态/
从 /无功/网络/ ABC /静态/
目录,以及其他一切送达形式 /无功/网络
。
That makes addresses starting with /app/
to be served from a wsgi handler, addresses staring with /static/
from /var/www/abc/static/
directory, and everything else is served form /var/www
.
不过有一个大安全问题与您的设置。你不应该让你的Django项目是一个DocumentRoot的文件夹内的文件夹中。你快把所有源$ C $ c和设置(包括数据库密码和cookie的签名密钥!)访问的任何人。立即从 /无功/网络
移动Django项目了。
There is however a huge security issue with your setup. You should not keep your Django project in a folder that is inside a DocumentRoot folder. You are making all your source code and settings (including database passwords and cookie signing secret keys!) accessible to anyone. Move the Django project away from /var/www
immediately.
这篇关于Django和PHP在单一的IP和端口的服务器只在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!