简体   繁体   English

使用mod_wsgi进行动态批量托管

[英]Dynamic mass hosting using mod_wsgi

I am trying to configure an apache server using mod_wsgi for dynamic mass hosting. 我正在尝试使用mod_wsgi配置用于动态批量托管的apache服务器。 Each user will have it's own instance of a python application located in /mnt/data/www/domains/[user_name] and there will be a vhost.map telling me which domain maps to each user's directory (the directory will have the same name as the user). 每个用户都将在/ mnt / data / www / domains / [user_name]中拥有自己的python应用程序实例,并且会有一个vhost.map告诉我哪个域映射到每个用户的目录(该目录将具有相同的名称作为用户)。 What i do not know is how to write the WSGIScriptAliasMatch line so that it also takes the path from the vhost.map file. 我不知道如何写WSGIScriptAliasMatch行,以便它也可以从vhost.map文件获取路径。 What i want to do is something like this: I can have on my server different domains like www.virgilbalibanu.com or virgil.balibanu.com and flaviu.balibanu.com where each domain would belog to another user, the user name having no neccesary connection to the domain name. 我想要做的是这样的:我可以在服务器上拥有不同的域,例如www.virgilbalibanu.com或virgil.balibanu.com和flaviu.balibanu.com,其中每个域都将登录到另一个用户,该用户名没有域名的必要连接。 I want to do this beacuse a user, wehn he makes an acoount receives something like virgil.mydomain.com but if he has his own domain he can change it later to that, for example www.virgilbalibanu.ro, and this way I would only need to chenage the line in the vhost.map file So far I have something like this: 我想这样做是因为用户,如果他让一个助手收到了类似virgil.mydomain.com之类的东西,但是如果他拥有自己的域,他可以稍后将其更改为该域,例如www.virgilbalibanu.ro,这样我就可以只需要更改vhost.map文件中的行,到目前为止,我有这样的内容:

Alias /media/ /mnt/data/www/iitcms/media/
#all media is taken from here

RewriteEngine on

RewriteMap lowercase int:tolower

# define the map file
RewriteMap vhost txt:/mnt/data/www/domains/vhost.map

#this does not work either, can;t say why atm
RewriteCond %{REQUEST_URI} ^/uploads/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/media/uploads/$1

#---> this I have no ideea how i could do
WSGIScriptAliasMatch ^([^/]+) /mnt/data/www/domains/$1/apache/django.wsgi

<Directory "/mnt/data/www/domains">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<DirectoryMatch ^/mnt/data/www/domains/([^/]+)/apache>
  AllowOverride None 
  Options FollowSymLinks ExecCGI
  Order deny,allow
  Allow from all
</DirectoryMatch>

<Directory /mnt/data/www/iitcms/media>
  AllowOverride None
  Options Indexes FollowSymLinks MultiViews 
  Order allow,deny 
  Allow from all 
</Directory>

<DirectoryMatch ^/mnt/data/www/domains/([^/]+)/media/uploads>
  AllowOverride None
  Options Indexes FollowSymLinks MultiViews 
  Order allow,deny 
  Allow from all 
</DirectoryMatch>

I know the part i did with mod_rewrite doesn't work, couldn't really say why not but that's not as important so far, I am curious how could i write the WSGIScriptAliasMatch line so that to accomplish my objective. 我知道我用mod_rewrite所做的部分不起作用,无法真正说出为什么不这样做,但是到目前为止,这还不那么重要,我很好奇我如何编写WSGIScriptAliasMatch行以实现我的目标。 I would be very grateful for any help, or any other ideas related to how i can deal with this. 我将非常感谢您提供的任何帮助或其他与我如何处理此问题有关的想法。 Also it would be great if I'd manage to get each site to run in wsgi daemon mode, thou that is not as important. 如果我设法让每个站点都在wsgi守护程序模式下运行,那也很好,您那不是那么重要。

Thanks, Virgil 谢谢,维吉尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM