Apache2 vHost配置 - 默认服务器?

时间:2017-03-15 17:13:45

标签: apache apache2 default

我的apache2配置有问题...

首先,输出apache2ctl -t -D DUMP_VHOSTS:

xx.xx.xx.xx:80       is a NameVirtualHost
         default server dom1.domain.me (/etc/apache2/sites-enabled/dom1.conf:1)
         port 80 namevhost dom1.domain.me (/etc/apache2/sites-enabled/dom1.conf:1)
         port 80 namevhost dom2.site.me (/etc/apache2/sites-enabled/dom2.conf:1)
xx.xx.xx.xx:443      is a NameVirtualHost
         default server dom1.domain.me (/etc/apache2/sites-enabled/dom1-ssl.conf:2)
         port 443 namevhost dom1.domain.me (/etc/apache2/sites-enabled/dom1-ssl.conf:2)
         port 443 namevhost dom3.site.me (/etc/apache2/sites-enabled/dom3.conf:1)
         port 443 namevhost cloud.site.me (/etc/apache2/sites-enabled/owncloud_ssl.conf:1)
         port 443 namevhost piwik.site.me (/etc/apache2/sites-enabled/piwik_ssl.conf:1)
*:443                  v123456.goodsrv.de (/etc/apache2/sites-enabled/000-default-ssl.conf:2)
*:80                   v123456.goodsrv.de (/etc/apache2/sites-enabled/000-default.conf:2)

问题:如果我在浏览器中打开v123456.goodsrv.de,我会从dom1.domain.me(/etc/apache2/sites-enabled/dom1.conf)获取该网站。

现在我想要浏览v123456.goodsrv.de或者iamnotspecified.domain.me来加载000-default.conf或者使用ssl(端口443)加载000-default-ssl.conf ......

任何人都知道,这里的问题是什么?

在/ etc / apache2 / sites-enabled /

中启用了000-default.conf和000-default-ssl.conf

谢谢!

我的系统正在使用最新的apache2在debian jessie上运行......

干杯, - j

- PS:我还尝试在config /etc/apache2/apache2.conf中尝试IncludeOptional 000-default * conf,但这也无效:(

- 我在启用站点的站点配置看起来像这样(指定了VirtualHost和ServerName):

<VirtualHost dom1.domain.me:80>

        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName dom1.domain.me

        ServerAdmin webmaster@domain.me
        DocumentRoot /var/www/html/dom1

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error_dom1.log
        CustomLog ${APACHE_LOG_DIR}/access_dom1.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =dom1.domain.me
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>

000-default.conf看起来像这样:

# default
<VirtualHost _default_:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

此处,VirtualHost是默认:80并且未设置ServerName(#)......

也试过而不是但它也不起作用......没有更多的想法......

语法正常(apache2ctl -t)

THX!

0 个答案:

没有答案