我将从描述我想要达到的目标开始。
首先我有一个主域是xxx.pl ,域有4个子域000.xxx.pl , 111.xxx.pl , 222.xxx.pl , 333.xxx.pl 。 另外我有另一个域yyy.pl与自己的子域(大多是相同的)。 当然这将是更多的领域,但它不是重点。
现在我需要的是没有为http设置虚拟主机的任何域,将指向/var/www/pl.xxx和https一样。 (所以它的默认网站),现在我已经设置为(和类似的https):
启用站点-/ 999默认
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/vhosts/pl.xxx <Directory /var/www/vhosts/pl.xxx> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
所以,据我所知,这个文件将作为最后加载,所以如果没有更精确的答案,Apache会去那里。
然后有主域的文件(HTTP和HTTPS是一样的,除了键等),这将在默认站点configuration之前加载。
启用站点-/ 998-pl.xxx
<VirtualHost *:80> ServerAdmin [email protected] ServerName xxx.pl ServerAlias *.xxx.pl DocumentRoot /var/www/vhosts/pl.xxx <Directory /var/www/vhosts/pl.xxx> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
现在我需要指定2个域名(仅在https上),在http上他们应该使用sites-enabled / 998-pl.xxxconfiguration。
启用站点-/ 997-pl.xxx.000
ServerAdmin [email protected]
ServerName 000.xxx.pl ServerAlias 000.xxx.pl DocumentRoot /var/www/vhosts/pl.xxx.000 <Directory /var/www/vhosts/pl.xxx.000> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
除了在https上使用与000.xxx.pl地址相同的configuration,其他域名yyy.pl都是好的。 而我需要它来限制只有000.xxx.pl使用这个地址。 并非所有其他未分配的域名。
所以https://yyy.pl | https://000.yyy.pl等应使用default-ssl设置而不是000.xxx.pl设置。
请帮我理解发生了什么事。 也许我误解了Apache的configuration使用情况。
编辑:
一般来说问题部分解决了,因为它工作。 但是关于子域configuration的依赖项/ etc / hosts条目有一个有趣的地方。
启用站点-/ 999默认
[…]
所以,据我所知,这个文件将作为最后加载,所以如果没有更精确的答案,Apache会去那里。
这反过来工作。 所以要显示为默认的网站应该是Apache必须parsing的第一个网站。 我会把它命名为000-默认的或者其他什么。