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.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启
  • ¥15 51寻迹小车定点寻迹
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题
  • ¥15 idea自动补全键位冲突
  • ¥15 请教一下写代码,代码好难
  • ¥15 iis10中如何阻止别人网站重定向到我的网站
  • ¥15 滑块验证码移动速度不一致问题
  • ¥15 Utunbu中vscode下cern root工作台中写的程序root的头文件无法包含