简体   繁体   English

Apache on CentOS在配置路由到“ Index.html”(大写“ I”)时出现问题

[英]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.

相关问题 Web浏览器不在htdocs目录中显示index.html - Apache - Web browser not displaying the index.html in the htdocs directory - Apache apache 重定向 /url1/* 到 /url1/index.html - apache redirect /url1/* to /url1/index.html 为什么我只为 index.php 文件而不是 index.html 文件收到 403 禁止错误? (Apache2, debian11) - Why am i getting a 403 forbidden error only for index.php files not index.html ones? (Apache2, debian11) 找不到我正在使用的index.html - Can't find what index.html I am using ubuntu 网络服务器上的 apache2 拒绝访问所提供索引以外的任何其他文件的权限。html - apache2 on ubuntu webserver rejects permission to access any other file than the delivered index.html 安装SDX麻烦org.apache.cocoon.ResourceNotFoundException:没有管道匹配的请求:index.html - Installing SDX trouble org.apache.cocoon.ResourceNotFoundException: No pipeline matched request: index.html Apache 虚拟主机不在域名处为虚拟主机“index.html”提供服务 - Apache Virtual Host isn't Serving Virtual Host 'index.html' at Domain Name 为什么 Apache 不允许从 index.html 中访问 web 根目录之外的文件? - Why doesn't Apache allow access to files outside the web root from within index.html? Linux CentOS中的GRE隧道路由问题 - GRE Tunnel routing issue in Linux CentOS 配置Zend Guard后Apache不会重新启动-CentOS 7 - Apache doesn't restart after configuring Zend Guard - CentOS 7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM