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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。