Django / mod_wsgi和PHP作为使用MAMP的同一Apache服务器上的虚拟主机 [英] Django/mod_wsgi and PHP as Virtual Hosts on same Apache Server using MAMP
问题描述
更新:我的原始问题在下面,但我发布的问题代码已经编辑到最终的工作解决方案。
我试图在我的MAMP开发服务器上运行多个站点。一些网站是在MAMP中的htdocs中生成的wordpress网站,其中一些网站是django应用程序,它们位于名为djangoprojects的文件夹中。
I am trying to run multiple sites on my MAMP development server. Some of the sites are wordpress sites that live in the htdocs in MAMP and some of the sites are django apps that live in a folder titled djangoprojects.
我一直在尝试实现这些堆栈问题的解决方案:
I have been trying to implement the solutions from these stack questions:
如何在一个Apache服务器上一起运行Django和PHP?
但我没有成功。我能够使用您在第一个VirtualHost括号(从守护进程行开始)中看到的代码,在apache上运行django站点,但是没有任何php站点可以访问。
but I have not been successful. I was able to run the django site on apache with the code you see in the first VirtualHost brackets (from the daemon process line onward) but then none of the php sites could be visited.
帮助非常感谢。我是新的,我无法解决错误。
Help is greatly appreciated. I am new with this and I can't work out the errors.
这是httpd.conf中的代码:
Here is the code from my httpd.conf:
更新:下面的代码工作。本地服务器上都存在Django App和PHP应用程序。 PHP相关的VirtualHost东西从MAMP httpd.conf文件中进一步复制。
<VirtualHost *:80>
ServerName localhost:80
UseCanonicalName Off
DocumentRoot "/Applications/MAMP/htdocs"
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
<Directory "/Applications/MAMP/htdocs">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess site1 display-name=%{GROUP}
WSGIProcessGroup site1
Alias /media/ /Users/sequoia/djangoprojects/dynamics/media/
<Directory /Users/sequoia/djangoprojects/dynamics/media>
Options ExecCGI
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias /dynamics /Users/sequoia/djangoprojects/dynamics/apache/django.wsgi
<Directory /Users/sequoia/djangoprojects/dynamics/apache>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
推荐答案
开始的几个问题:
- ServerName是指定主机名而不是URL路径的意思。
- 您不应该将DocumentRoot设置为您的Django网站源代码在哪里。
这篇关于Django / mod_wsgi和PHP作为使用MAMP的同一Apache服务器上的虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!