简体   繁体   English

Apache2:2个具有子域的虚拟主机不起作用

[英]Apache2: 2 virtual hosts with subdomains not working

I have set up one conf file in apache with 2 virtual hosts: 我在apache中设置了一个conf文件,其中包含2个虚拟主机:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName test.domain.com
    WSGIScriptAlias / /var/django/test/test/wsgi.py
    <Directory /var/django/test/test>
    <Files wsgi.py>
    Require all granted
    </Files>
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *.80>
    ServerAdmin webmaster@localhost
    ServerName domain.com
    #ServerAlias *.domain.com
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

But unfortunately only the first one is being called no matter what domain I put into the browser. 但是不幸的是,无论我将哪个域放入浏览器,都只会调用第一个。

My expectation is that only test.domain.com will open my Django project and all other subdomains use the standard website. 我的期望是只有test.domain.com才能打开我的Django项目,而所有其他子域都使用标准网站。

What did I do wrong? 我做错了什么?

Regards 问候

Kev 凯夫

The error is here: 错误在这里:

after replacing the dot wih a ":" the it worked perfekt. 在用“:”替换圆点后,它的性能非常好。

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

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