doubengshao8872 2011-06-25 23:52
浏览 67
已采纳

Django / mod_wsgi和PHP作为使用MAMP的同一Apache服务器上的虚拟主机

UPDATE: My original question is below, but the code I posted with the question has been edited to the final working solution.

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:

multiple django sites with apache & mod_wsgi

How do I run Django and PHP together on one Apache server?

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.

Here is the code from my httpd.conf:

UPDATE: The code below works. Both the Django App and the PHP applications exist on the localhost server. The PHP related VirtualHost stuff was copied from further up in the MAMP httpd.conf file.

<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>
  • 写回答

1条回答 默认 最新

  • dqluw20882 2011-06-26 00:42
    关注

    A couple of problems to start with:

    1. ServerName is mean to specify the host name not a URL path.
    2. You should never set DocumentRoot to be where your Django site source code is.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 怎么在stm32门禁成品上增加记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app