【问题标题】:Webserver uses old non existing files to render websiteWebserver 使用旧的不存在的文件来呈现网站
【发布时间】:2018-02-25 17:53:27
【问题描述】:

我已将文件上传到我的网站。当我查看网站时,在线 html 是这样的:

但是,这绝对不是在线文件。我已经尝试更新它很多次了。但是,它仍然呈现我很久以前使用的文件。我试图删除我的缓存和 cookie。但是由于一些奇怪的原因,它仍然设法使用一个旧的已删除文件……这是为什么呢?

应该在线的html是这样的:

{% extends "layout.html.twig" %}

{% block content %}

<div id="preloader"></div>

<div id="s1" class="hero">
    <div id="menu_block" name="menu_block" class="menu_block right">
        <nav class="nav_block">
            <a href="#s1">Home</a>
            <a href="#s2">About</a>
            <a href="#s3">Projects</a>
            <a href="#s4">Skills</a>
            <a href="#s5">Resume</a>
            <a href="#s6">Contact</a>
        </nav>
    </div>

    <div class="container vertical center">
        <div class="title white">
            Lex de Willigen
        </div>
        <div class="subtitle white">
            DEVELOPER
        </div>
        <div class="subsubtitle">
            <i>Hello, my name is Lex and I'm <br>
            a developer from the Netherlands!</i>
        </div>
    </div>
</div>

<div id="s2" class="section">
    <div class="container vertical center" style="margin-top: 10px;">
        <i class="fa fa-user fa-4x"></i>
    </div>
    <div class="container vertical center" style="">
        <h2 style="font-weight: 900; font-family: arial; color: black;">
            WHO AM I?
        </h2>
    </div>
    <div class="container vertical center" style="">
        <p>
            <b>Hi!</b> My name is Lex. 
            <h3 class="animate">And I'm developer</h3>
        </p>
    </div>
</div>

<div id="s3" class="section">
    <div class="container vertical center" style="">
        <h2>
            Projects
        </h2>
    </div>
</div>

<div id="s4" class="section">
    <div class="container vertical center" style="">
        <h2>
            Skills
        </h2>
    </div>
</div>

<div id="s5" class="section">
    <div class="container vertical center" style="">
        <h2>
            Resume
        </h2>
    </div>
</div>

<div id="s6" class="section">
    <div class="container vertical center" style="width: 50%;">
        <h2>
            Contact
        </h2>

        {% if form is defined %}
            <form action="" method="post">
                {{ form_widget(form) }}
            </form>
        {% endif %}
    </div>
</div>
{% endblock %}

一些额外的细节:

  1. 我正在使用 Silex 框架
  2. 出于某种原因,我的 javascript 始终无法正常工作,但这可能是因为新文件从未加载过
  3. 如果需要,我可以提供我的网站,以防您想检查可能是什么问题

【问题讨论】:

  • 您只是在您的计算机或其他设备上遇到此问题?我的意思是,如果您尝试从例如您的手机访问此页面,您还会获得旧文件吗?
  • 你使用cloudflare 吗?如果是,请尝试从 cloudflare 仪表板中清除缓存。
  • @AlbertoMartinez 不,我在两台电脑上试过,都遇到同样的问题
  • @RafaelHovsepyan 不,我没有使用 cloudflare
  • 它是某种形式的服务器端缓存。这是共享主机吗?如果是这样,请在面板中查找任何缓存设置。 Twig 也可以配置缓存模板stackoverflow.com/questions/16386925/…

标签: javascript php webserver silex filezilla


【解决方案1】:

您的服务器端缓存。请检查 php.ini 是否 opcache expiry time 设置的太长。

  • Opcache 可以缓存。

  • Nginx 网络服务器缓存。

【讨论】:

  • 我发现了如何删除缓存!页面正在更新
  • 没有,在我的 Silex 项目(我正在使用 fabpot 框架)中保存了缓存。我删除了这些文件夹中的所有内容,然后它又起作用了!
  • 哦,好吧,当你说它没有被输出更新时。我刚来到它的缓存..主要是服务器端也有缓存。如果它启用了这么长时间,它可能会导致同样的事情:)
猜你喜欢
  • 2014-07-28
  • 2022-10-16
  • 2013-09-19
  • 2023-03-24
  • 2015-12-29
  • 2020-10-25
  • 2013-02-16
  • 2020-07-19
  • 2021-11-18
相关资源
最近更新 更多