Home > Article > Backend Development > Apache服务器上同时运行php的网站和django的网站,该如何配置Apache和Django的URL?
已经安装的软件:Apache2.2 mod_wsgi php5 等.
想要:
1. 使用同一个端口,同一个domain。
2. 把/django_site/* 这样的url全部交给django处理
无奈自己试了很多种配置方式,均出现古怪的错误。
<code class="language-php"><span class="cp"></span> <span class="k">echo</span> <span class="nb">phpinfo</span><span class="p">();</span> <span class="cp">?></span><span class="x"></span>
</code>
配置httpd-vhosts.conf文件<code class="language-apacheconf"><span class="nt"><virtualhost> <span class="s">*:80</span><span class="nt">></span>
<span class="nb">WSGIScriptAlias</span> <span class="sx">/django_site</span> <span class="s2">"/path/to/www/django_site.wsgi"</span>
<span class="nt"><directory> <span class="s">"/path/to/www/django_site"</span><span class="nt">></span>
<span class="nb">Order</span> Deny,Allow
<span class="nb">Allow</span> from <span class="k">all</span>
<span class="nt"></span></directory></span>
<span class="nb">Alias</span> <span class="sx">/images</span> <span class="s2">"/path/to/www/images"</span>
<span class="nb">Alias</span> <span class="sx">/layout</span> <span class="s2">"/path/to/www/layout"</span>
<span class="nt"></span></virtualhost></span>
</code>