[英]Apache on CentOS issue configuring routing to “Index.html” (uppercase“I”)
I have a project being deployed such that an Apache instance is running on CentOS (DMZ) which is due to forward all requests to a TOMCAT instance running behind the firewall. 我正在部署一个项目,以使Apache实例在CentOS(DMZ)上运行,这是由于将所有请求转发到在防火墙后运行的TOMCAT实例。 For instance, a request: 例如,一个请求:
www.Example.com
needs to be forwarded to: 需要转发给:
HTTP://<servername behind the firewall>:<port number>/Blabla/Index.html
(Note that Index.html has a capital I ). (请注意, Index.html具有大写字母 I )。
I should note that the whole project required extensive review as it was developed under Windows (case insensitive filenames) but the running environment is Linux, and now all filenames and their references are fully synchronized. 我应该注意,由于整个项目是在Windows(不区分大小写的文件名)下开发的,因此需要进行广泛的审查,但是运行环境是Linux,现在所有文件名及其引用都已完全同步。
The problem appears to be that it is not possible to configure within Apache to forward requests to Index.html and it converts it to index.html , which does not exist. 问题似乎在于,无法在Apache中进行配置以将请求转发到Index.html,并将其转换为index.html ,该索引不存在。
I can change all the file names to lowercase, but this will take quite some effort. 我可以将所有文件名都更改为小写,但这需要花费一些精力。
Is there any way to force Apache to use as-is what I define (ie if lowercase, use lowercase; if uppercase, use uppercase; if mixed, use mixed). 有什么方法可以强迫Apache按原样使用(即,如果小写,则使用小写;如果大写,则使用大写;如果混合,则使用混合)。
Thanks in advance. 提前致谢。
You should be able to use mod_speling from Apache. 您应该能够使用Apache的mod_speling。 In your configuration file, simply put: 在您的配置文件中,只需输入:
CheckSpelling On
CheckCaseOnly On
And reload Apache using either: 并使用以下任一方式重新加载Apache:
/etc/init.d/httpd reload
Or if you're using CentOS 7: 或者,如果您使用的是CentOS 7:
systemctl reload httpd
This should now make all the files in your website directory insensitive. 现在,这应该使您网站目录中的所有文件不敏感。
If you're using virtualhosts, you may add this option into it: 如果您使用的是虚拟主机,则可以在其中添加以下选项:
DirectoryIndex Index.html
So your virtualhost should be like that : 因此,您的虚拟主机应为:
<VirtualHost *:80>
ServerName website_name
DocumentRoot website_directory
DirectoryIndex Index.html
</VirtualHost>
You can paste it in /etc/httpd/conf.d/mywebsite.conf and reload apache with : 您可以将其粘贴到/etc/httpd/conf.d/mywebsite.conf中,并使用以下命令重新加载apache:
systemctl reload httpd
If you have CentOS/7. 如果您有CentOS / 7。 For older versions of CentOS use this command: 对于较旧版本的CentOS,请使用以下命令:
service httpd reload
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.