在Apache中运行Django和PHP应用程序 [英] Run both Django and PHP application in Apache

查看:83
本文介绍了在Apache中运行Django和PHP应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Apache中托管Django和PHP(wordpress)应用程序

I'm trying to host Django and PHP(wordpress) app in Apache

domain.com,应指向Django应用domain.com/wp,应指向wordpress应用

domain.com, should point to Django app domain.com/wp, should point to wordpress app

这是我在/etc/apache2/sites-available中的000-default.conf

Here is my 000-default.conf in /etc/apache2/sites-available

<VirtualHost *:80>
    DocumentRoot "/var/www/html/wp"
    ServerName domain.com/wp
    Alias /wp /var/www/html/wp
    <Directory /var/www/html/wp>
        Options Indexes FollowSymLinks
        AllowOverride None
        Order Deny,Allow
        Allow from all
    </Directory>
</VirtualHost>                            

<VirtualHost *:80>
        Alias /static /var/www/html/portal/static
        <Directory /var/www/html/portal/static>
                Require all granted
        </Directory>

        <Directory /home/ubuntu/portal/portal>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>

        WSGIDaemonProcess portal python-path=/home/ubuntu/portal:/home/ubuntu/portal/env/lib/python2.7/site-packages
        WSGIProcessGroup portal
        WSGIScriptAlias / /home/ubuntu/portal/portal/wsgi.py
</VirtualHost>

domain.com带我去wordpress申请.

domain.com is taking me to wordpress application.

任何人都可以告诉我问题出在哪里,或者给我指示解决此问题的方法.

Can anyone tell me where the issue is or give me a direction to solve this.

推荐答案

几个问题,第一件事是ServerName只是一个服务器名,而不是URL.第二个问题是您应该合并两个VirtualHost条目.

Few issues, first thing is that the ServerName is just a servername and not a url. The second issue is that you should combine the two VirtualHost entries.

<VirtualHost *:80>
    DocumentRoot "/var/www/html"
    ServerName domain.com
    Alias /wp /var/www/html/wp
    <Directory /var/www/html/wp>
        Options Indexes FollowSymLinks
        AllowOverride None
        Order Deny,Allow
        Allow from all
    </Directory>

    Alias /static /var/www/html/portal/static
    <Directory /var/www/html/portal/static>
                Require all granted
    </Directory>

    # this really should be a sub directory of /var/www/html
    # if your server config follows symlinks, just make a symlink  
    <Directory /home/ubuntu/portal/portal>
                <Files wsgi.py>
                        Require all granted
                </Files>
    </Directory>

    WSGIDaemonProcess portal python-path=/home/ubuntu/portal:/home/ubuntu/portal/env/lib/python2.7/site-packages
    WSGIProcessGroup portal
    WSGIScriptAlias / /home/ubuntu/portal/portal/wsgi.py
</VirtualHost>

这篇关于在Apache中运行Django和PHP应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆