1

我试图让两个 apache 虚拟主机与 mod_wsgi 和 python 一起工作,我想访问不同文件夹中的两个站点:即 example.com/sh 和 example.com/th 这是我尝试过的:

WSGISocketPrefix /var/run/moin-wsg

<VirtualHost *:80>
    ServerAdmin sth@domain.com
    serverName  sub.example.com
    serverAlias www.sub.example.com
    WSGIScriptAlias /sh   /opt/source/sh/moin.wsgi
    WSGIDaemonProcess  sh  user=th group=apache threads=5    python-path=/opt/source/sh/env/lib/python2.7/site-packages
    WSGIProcessGroup sh
    ErrorLog logs/sh.foo.info-error_log
    CustomLog logs/sh.foo.info-access_log common
<Location /sh>
    WSGIProcessGroup sh
</Location>
<Directory /opt/source/sh>
   Options Indexes FollowSymLinks
   Order allow,deny
   allow from all
</Directory>
</VirtualHost>

WSGISocketPrefix /var/run/th
<VirtualHost *:80>
    ServerAdmin example@domain.com
    serverName  sub.example.com
    serverAlias www.sub.example.com
    WSGIScriptAlias /site1   /opt/source/th/moin.wsgi
    WSGIDaemonProcess  th  user=th group=apache threads=5    python-path=/opt/source/th/env/lib/python2.7/site-packages
    ErrorLog logs/th.foo.info-error_log
    CustomLog logs/th.foo.info-access_log common
<Location /th>
    WSGIProcessGroup th
</Location>
<Directory /opt/source/th/>
   Options Indexes FollowSymLinks
   Order allow,deny
   allow from all
</Directory>
</VirtualHost>

此时只有第一个站点有效,第二个站点给出了 404 未找到,我该如何解决?这两个站点都是基于 python 的 wiki

4

1 回答 1

1

所以就像 Dumpleton 说的,这就是我最终这样做的方式:

WSGISocketPrefix /var/run/moin-wsg

<VirtualHost *:80>
    ServerAdmin sth@domain.com
    serverName  sub.example.com
    serverAlias www.sub.example.com
    WSGIScriptAlias /sh   /opt/source/sh/moin.wsgi
    WSGIDaemonProcess  sh  user=th group=apache threads=5    python-path=/opt/source/sh/env/lib/python2.7/site-packages
    WSGIProcessGroup sh
    ErrorLog logs/sh.foo.info-error_log
    CustomLog logs/sh.foo.info-access_log common
<Location /sh>
    WSGIProcessGroup sh
</Location>
<Directory /opt/source/sh>
   Options Indexes FollowSymLinks
   Order allow,deny
   allow from all
</Directory>

   WSGIScriptAlias /site1   /opt/source/th/moin.wsgi
    WSGIDaemonProcess  th  user=th group=apache threads=5    python-path=/opt/source/th/env/lib/python2.7/site-packages
    ErrorLog logs/th.foo.info-error_log
    CustomLog logs/th.foo.info-access_log common
<Location /th>
    WSGIProcessGroup th
</Location>
<Directory /opt/source/th/>
   Options Indexes FollowSymLinks
   Order allow,deny
   allow from all
</Directory>

</VirtualHost>
于 2013-06-05T08:11:29.987 回答