本文介绍了Apache虚拟主机不工作的权利的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知怎的,我的虚拟主机文件不连续工作我不知道为什么 - 我敢打赌,它只是在我的早安大脑mailfunction:P

Somehow my Virtual host files are not working straight I can't tell why - I bet it's just a mailfunction in my good-morning brain :p

现在我通过一个符号链接启用在网站提供两个地点的/ etc / apache2的/目录,如:

Right now I got TWO sites enabled via a symbolic link to sites available in /etc/apache2/ directory like :

0 Nov 21 12:24 000-default -> ../sites-available/default
0 Nov 21 14:52 001-site -> ../sites-available/site

我的虚拟主机文件看起来像:

my VHosts files look like :

默认

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName (the IP Address from my Server)
        ServerAlias (the 2nd IP Address from my Server)
        DocumentRoot /var/www/default
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/default>
                Options FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

网站

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/site/
    ServerName jobbörse-köln.de
    ServerAlias www.example.de ww.example.de w.example.de

    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/site>
            Options FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/site-error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/site-access.log combined
</VirtualHost>

不知怎的,当我去example.de我得到的默认目录,而不是网站目录。
即使日志文件:

Somehow when I go on "example.de" I get to the DEFAULT Directory instead of the SITE Directory.Even the log files :

site-error.log
site-access.log

停留在0字节......我究竟做错了什么?我敢打赌,这是愚蠢的东西,容易...

stay on 0 bytes ... what am I doing wrong ? I bet it's something dumb and easy ...

推荐答案

您使用的是默认端口80为虚拟主机条目。所以,我希望你使用了NameVirtualHost *:80为配置

You are using the default 80 port for both the virtual host entry. So I hope you are using NameVirtualHost *:80 as configuration.

在您共享虚拟主机的配置越来越overlaped的80端口,所以第一个拥有precedence。

in the configuration you shared VirtualHost are getting overlaped on port 80, so the first has precedence.

这篇关于Apache虚拟主机不工作的权利的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 22:40