apache 别名和.htacess 愿意了解配置吗?
在我们的本地开发环境中,我们只有一台服务器,为了向静态图像添加远期过期和缓存控制标头,我们在应用程序的根目录中保留了一个 .htaccess 文件,一切工作正常。但在我们的产品上,我们有多个 apache 服务器,它们具有不同服务器上代码库的别名。在这种情况下,我不确定将 .htacess 文件保存在哪里。我应该将其保留在代码库中还是单独的 apache 服务器上。我如何将 .htaccess 文件中写入的相同内容写入 httpd.conf 文件中。
On our local dev enviornment we had just one server and to add far future expires and cache control header to static images we kept a .htaccess file in the root of the application things worked fine. But on our prod we have multiple apache servers having aliases to a code base on a different server. Here in this case i am not sure where to keep .htacess file on. Should i be keeping it on code base or on the individual apache servers. How can i write the same stuff that i have written in .htaccess file to httpd.conf file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它是特定于应用程序的设置,那么我会在代码库中说。
如果该文件还包含特定于服务器的设置,请考虑在代码库中保留一个
.htaccess.dist
,其中包含特定于应用程序的任何全局配置值(URL 重写等)和本地.htaccess
包含全局值和本地设置。在这种情况下,.htaccess
永远不会签入您的代码库。通常只需将设置放入适当的
Directory
、Location
或VirtualHost
部分即可。 手册将告诉您哪个属于哪里。If it's settings specific to the application, then I'd say in the code base.
If the file also contains settings specific to the server, consider keeping a
.htaccess.dist
in the code base containing any global configuration values specific to the application (URL rewriting etc.) and a local.htaccess
containing the global values plus your local settings. The.htaccess
would never get checked in to your code base in this scenario.Usually by just putting the settings into the appropriate
Directory
,Location
orVirtualHost
sections. The manual will tell you which belong where.