现在我的Apacheconfiguration只适用于localhost域( http:// localhost / )。
Alias /media/ "/ścieżka/do/instalacji/django/contrib/admin/media/" Alias /site_media/ "/ścieżka/do/plikow/site_media/" <Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE settings PythonPath "['/thomas/django_projects/project'] + sys.path" PythonDebug On </Location> <Location "/site_media"> SetHandler none </Location>
我怎样才能使它为一些像pl.localhost或uk.localhost子域? 这个子域名应该显示同一个页面的域名(localhost)。
第二个问题:可以将默认本地主机地址( http:// localhost / )更改为( http://localhost.com/ )或( http://www.localhost.com/ )或其他内容?
最简单和临时的解决scheme是编辑你的'/ etc / hosts'文件并添加如下内容:
127.0.0.1 pl.localhost 127.0.0.1 uk.localhost 127.0.0.1 www.localhost.com
它的工作原理是在询问DNS服务器之前检查“/ etc / hosts”。 这是默认configuration,但是当它不工作时,检查'/etc/nsswitch.conf',并更改行:
hosts: ...
将“文件”作为序列中的第一个条目。
另一种更好,但更耗时的解决scheme是运行你自己的bind9名字服务器。 还要检查Apache中的虚拟名称主机configuration。 它简化了事情。