Apache发送损坏或“dif”文件

时间:2016-11-03 05:18:12

标签: html apache caching centos

Apache正在做一些非常奇怪的事情。起初看起来我的浏览器总是加载缓存副本。我通过禁用缓存,使用新浏览器和使用curl来排除这一点,我100%确信这不是客户端缓存问题。

我有一个包含非常少内容的html文件,我只是更改了标题中的标题并刷新了但是Apache给了我完全相同的文件。

这真的很奇怪,如果我删除文件的“足够大”的部分,Apache会向我发送一个更新的文件,但它将是一个奇怪的混合或两个版本的坏差异。

原件:

<!DOCTYPE html>
<html ng-app="EndeavorApp" ng-controller="RootCtrl">
<head>
    <title></title>
    <link rel="stylesheet" href="css/endeavor.css" />
</head>
<body>


<div id='work-space' ng-controller="TimelineCtrl">
    <div id='content'>
        <div id='project-column'>
            <div class='project' ng-style="{height:project.$$height + 'px'}" ng-repeat="project in TCtrl.projects">
                {{project.name}}
            </div>
        </div>
        <div id='time-line-column'>
            <div ng-style="{width:TCtrl.timeLineWidth + 'px'}" id='block-view'>
                <div class='project' ng-style="{height:project.$$height + 'px'}" ng-repeat="project in TCtrl.projects">
                    <div ng-repeat="block in project.blocks" ng-style="TCtrl.getBlockStyle(block)" class='block'>
                        <div class='block-content'></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<script src="js/angular.endeavor.min.js"></script>
<script src="js/endeavor.js"></script>

</body>
</html>

在标题标记中添加内容没有任何效果。删除head标签中的所有内容都没有做任何事返回相同的该死的文件。

如果我删除了最后2个<script>标签并添加了标题,我会收到这个不完整的文件(请注意它会在脚本标签上切断)

<!DOCTYPE html>
<html ng-app="EndeavorApp" ng-controller="RootCtrl">
<head>
    <title></title>
    <link rel="stylesheet" href="css/endeavor.css" />
</head>
<body>


<div id='work-space' ng-controller="TimelineCtrl">
    <div id='content'>
        <div id='project-column'>
            <div class='project' ng-style="{height:project.$$height + 'px'}" ng-repeat="project in TCtrl.projects">
                {{project.name}}
            </div>
        </div>
        <div id='time-line-column'>
            <div ng-style="{width:TCtrl.timeLineWidth + 'px'}" id='block-view'>
                <div class='project' ng-style="{height:project.$$height + 'px'}" ng-repeat="project in TCtrl.projects">
                    <div ng-repeat="block in project.blocks" ng-style="TCtrl.getBlockStyle(block)" class='block'>
                        <div class='block-content'></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<script src="js/angula

删除<body>中的所有内容会导致此混乱(注意标题仍为空)

<!DOCTYPE html>
<html ng-app="EndeavorApp" ng-controller="RootCtrl">
<head>
    <title></title>
    <link rel="stylesheet" href="css/endeavor.css" />
</head>
<body>


<div id='work-space' ng-controller="TimelineCtrl">
    <div id='content'>
        <div id='project-column'>
            <div class='p

Apache也在文件的末尾发送了一些奇怪的unicode字符 enter image description here

服务器上的localhost卷曲(显示它不是缓存或js) enter image description here

在服务器上使用'more'来显示文件不是返回的内容 enter image description here

编辑:这是在使用vagrant的CentOS VM上运行,而webroot正在使用vagrants sharead文件夹。

1 个答案:

答案 0 :(得分:0)

我的一个朋友解决了这个问题。所有这一切都有一个重要的细节,结果证明是相关的。 Apache安装在Vagrant上运行,它的webroot是vagrants共享mount。

使用NFS mound时,操作系统和Apache出现了问题。

解决方案是在httpd.conf中设置它

EnableSendfile to off

有关此内容的更多详情:JS and CSS files in vagrant not properly encoded when saved outside of the VM