我是否有重复的端口80和443 VirtualHost指令? [英] Do I have to duplicate the Virtualhost directives for port 80 and 443?

查看:383
本文介绍了我是否有重复的端口80和443 VirtualHost指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有℃的长期和复杂的列表,虚拟主机>指令,我必须将它们复制到不同的<虚拟主机>组进行端口80和443,因为我使用SSL。每当我更新我的mod_rewrite的规则,我一定要记得做,在这两个地方,否则我会打破我的应用程序......这种重复是自找麻烦。有没有办法合并或别名这些 - 两者之间的唯一区别是,端口443版本包含SSLEngine的,了SSLCertificateFile和类似

I have a long and intricate list of <VirtualHost> directives, and I have to duplicate them into separate <VirtualHost> groups for ports 80 and 443 because I'm using SSL. Whenever I update my mod_rewrite rules I have to remember to do it in both places or else I'll break my app... this duplication is asking for trouble. Is there a way to combine or alias these -- the only difference between the two is that the port 443 version contains the SSLEngine, SSLCertificateFile and the like.

&我LT;虚拟主机&GT;包含许多mod_rewrite的规则,LocationMatch规则,CGI的指令等。

My <Virtualhost> contains many mod_rewrite rules, LocationMatch rules, CGI directives, etc.

另外,我无法使用.htaccess文件。

Also, I can't use .htaccess files.

推荐答案

你不能使用include指令包括共同规则。 这里

Can't you use an include directive to include the common rules. here

文章

例如:

<VirtualHost _default_:80>
    ...
    include conf/common_rule.conf
</VirtualHost>

<VirtualHost _default_:*>
    ...
    include conf/common_rule.conf
</VirtualHost> 

<VirtualHost _default_:443>
    ... #SSL rules
    include conf/common_rule.conf
</VirtualHost>  

这篇关于我是否有重复的端口80和443 VirtualHost指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆