Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在httpd.conf中放置两个带有mod_wsgi和python的apache虚拟主机?_Apache_Python 2.7_Mod Wsgi - Fatal编程技术网

如何在httpd.conf中放置两个带有mod_wsgi和python的apache虚拟主机?

如何在httpd.conf中放置两个带有mod_wsgi和python的apache虚拟主机?,apache,python-2.7,mod-wsgi,Apache,Python 2.7,Mod Wsgi,我试图让两个apache虚拟主机与mod_wsgi和python一起工作,我想访问不同文件夹中的两个站点:ie example.com/sh和example.com/th 这就是我所尝试的: WSGISocketPrefix /var/run/moin-wsg <VirtualHost *:80> ServerAdmin sth@domain.com serverName sub.example.com serverAlias www.sub.exampl

我试图让两个apache虚拟主机与mod_wsgi和python一起工作,我想访问不同文件夹中的两个站点:ie 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>
WSGISocketPrefix/var/run/moin wsg
服务器管理员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
错误日志/sh.foo.info-error\u日志
自定义日志/sh.foo.info-access\u日志公用
WSGIProcessGroup sh
选项索引跟随符号链接
命令允许,拒绝
通融
WSGISocketPrefix/var/run/th
服务器管理员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
错误日志/th.foo.info-error\u日志
自定义日志/th.foo.info-access\u日志公用
WSGIProcessGroup th
选项索引跟随符号链接
命令允许,拒绝
通融
此时只有第一个站点工作,第二个站点给出了一个404未找到,我如何修复它? 这两个网站都是基于python的wiki

,正如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>
WSGISocketPrefix/var/run/moin wsg
服务器管理员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
错误日志/sh.foo.info-error\u日志
自定义日志/sh.foo.info-access\u日志公用
WSGIProcessGroup sh
选项索引跟随符号链接
命令允许,拒绝
通融
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
错误日志/th.foo.info-error\u日志
自定义日志/th.foo.info-access\u日志公用
WSGIProcessGroup th
选项索引跟随符号链接
命令允许,拒绝
通融
就像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>
WSGISocketPrefix/var/run/moin wsg
服务器管理员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
错误日志/sh.foo.info-error\u日志
自定义日志/sh.foo.info-access\u日志公用
WSGIProcessGroup sh
选项索引跟随符号链接
命令允许,拒绝
通融
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
错误日志/th.foo.info-error\u日志
自定义日志/th.foo.info-access\u日志公用
WSGIProcessGroup th
选项索引跟随符号链接
命令允许,拒绝
通融

这两个站点的ServerName/ServerAlias值必须不同。如果希望每个应用程序在同一主机下运行,请不要使用两个VirtualHost定义,请使用其中一个并将两者的配置放在其中。这两个站点的ServerName/ServerAlias值必须不同。如果希望每个应用程序在同一主机下运行,请不要使用两个VirtualHost定义,而是使用一个,并将两个应用程序的配置都放在其中。