在单个虚拟主机上设置多个站点
所以有一个安装了 lamp 的 ubuntu 服务器。我们安装了 webmin,这样我们就有了一个 GUI,并在上面创建了一个虚拟主机。我们想要在此主机上托管三个站点,它们的设置如下
myserver.com/site1
myserver.com/site2
myserver.com/site3
在 site1 上我想使用 django,我使用 mod_wsgi 成功设置了该站点。但问题是,当我访问网站上的任何页面(例如 site2 或 site3)时,我可以看到它们上的 django 启动页面。我只希望 django 影响 site1 目录而不是 /site2 或 /site3。我不想在 site2 或 3 中使用 django
。这是我为虚拟主机设置指令的方式引起的问题吗?这是
<Directory /var/www/site1 >
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess site1 processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup site1
WSGIScriptAlias / /var/www/site1/apache/django.wsgi
So have an ubuntu server with lamp installed. We installed webmin so we would have a gui and we created a virtual host on it. There are three sites we want to host on this host and they are set up as so
myserver.com/site1
myserver.com/site2
myserver.com/site3
On site1 I want to use django which I set up sucessfully with mod_wsgi. But the problem is when I go to any page on the site like site2 or site3 I can see the django splash page on them. I only want django to be effecting the site1 directory not /site2 or /site3. I don't want to use django in site2 or 3.
Is this a problem caused by the way I set up the directives for the virtual host. Which is
<Directory /var/www/site1 >
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess site1 processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup site1
WSGIScriptAlias / /var/www/site1/apache/django.wsgi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WSGIScriptAlias
决定 Django 提供的服务。您已将其设置为服务根目录/
,因此所有路径都由 Django 提供服务。如果您只想让它为/site1
提供服务,请使用:The
WSGIScriptAlias
determines what Django serves. You've set it up to serve/
, the root, so all paths are served by Django. If you only want it to serve/site1
, use that:您的 WSGIScriptAlias (其作用类似于 apache Alias)正在将 '/' 站点根目录(所有内容)映射到 django.wsgi 脚本;尝试 WSGIScriptAlias /site1 /var/www/site1/apache/django.wsgi
your WSGIScriptAlias (which acts like apache Alias) is mapping '/' site-root (everything) to the django.wsgi script; try WSGIScriptAlias /site1 /var/www/site1/apache/django.wsgi instead