新安装的Magento 2.3.4后24小时清漆显示503错误

如何解决新安装的Magento 2.3.4后24小时清漆显示503错误

我遇到“错误503服务不可用”的问题,24小时后显示错误。我正在使用varnish-6.5.1使用最新的nginx服务器进行全页缓存。 Magento版本是2.3.4。我正在使用SSL证书,Magento处于开发人员模式。 我的清漆配置如下:

sudo systemctl edit --full  varnish


[Unit]
Description=Varnish Cache,a high-performance HTTP accelerator
After=network-online.target nss-lookup.target

[Service]
Type=forking
KillMode=process

# Maximum number of open files (for ulimit -n)
LimitNOFILE=131072

# Locked shared memory - should suffice to lock the shared memory log
# (varnishd -l argument)
# Default log size is 80MB vsl + 1M vsm + header -> 82MB
# unit is bytes
LimitMEMLOCK=85983232

# Enable this to avoid "fork failed" on reload.
TasksMax=infinity

# Maximum size of the corefile.
LimitCORE=infinity

ExecStart=/usr/sbin/varnishd \
          -a :6081 \
          -a 127.0.0.1:8443,PROXY \
          -p feature=+http2 \
          -f /etc/varnish/default.vcl \
          -s malloc,3G \
          -p pipe_timeout=600 \
          -p http_resp_hdr_len=65536 \
          -p http_resp_size=98304
ExecReload=/usr/sbin/varnishreload

[Install]
WantedBy=multi-user.target

我的nginx配置如下:

upstream fastcgi_backend {
  server  unix:/run/php/php7.3-fpm.sock;
}

server {
    listen 80;
    listen [::]:80;
    server_name 127.0.0.0.1 mysite.pl www.mysite.pl;
    return 301 https://mysite.pl$request_uri;
}

server {

  listen 443 ssl http2;
  server_name 185.243.53.221 127.0.0.1 mysite.pl www.mysite.pl;

  access_log   /var/log/nginx/www.mysite.pl.log;
  error_log    /var/log/nginx/www.mysite.pl-error.log;

  ssl_certificate_key /etc/nginx/ssl/www.mysite.pl.key;
  ssl_certificate     /etc/nginx/ssl/www.mysite.pl.pem;

  ssl_protocols TLSv1.2;
  ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SH$

  ssl_prefer_server_ciphers off;

  add_header X-Frame-Options "SAMEORIGIN";
  add_header Strict-Transport-Security max-age=31536000;
    keepalive_timeout 600s;
    location / {
        proxy_pass http://127.0.0.1:6081;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-Port 443;
        proxy_set_header Host $host;
    }

}

server {
    listen 8080;
    server_name 127.0.0.1 mysite.pl www.mysite.pl;
    set $MAGE_ROOT /var/www/magento2;
    include /var/www/magento2/nginx.conf.sample;
}

如何检查导致错误的原因?

解决方法

我使用命令

sudo varnishlog -d -q "vxid == 557088"

错误是“重启次数过多”,下面我粘贴了完整日志

*   << Request  >> 557088    
-   Begin          req 557087 restart
-   Timestamp      Start: 1603710828.024454 0.000236 0.000000
-   ReqStart       127.0.0.1 51688 a0
-   ReqMethod      GET
-   ReqURL         /
-   ReqProtocol    HTTP/1.0
-   ReqHeader      X-Real-IP: 83.6.151.188
-   ReqHeader      X-Forwarded-Proto: https
-   ReqHeader      X-Forwarded-Port: 443
-   ReqHeader      Host: wymienolej.pl
-   ReqHeader      X-Forwarded-Host: wymienolej.pl
-   ReqHeader      Connection: close
-   ReqHeader      cache-control: max-age=0
-   ReqHeader      upgrade-insecure-requests: 1
-   ReqHeader      user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/86.0.4240.75 Safari/537.36
-   ReqHeader      accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
-   ReqHeader      sec-fetch-site: none
-   ReqHeader      sec-fetch-mode: navigate
-   ReqHeader      sec-fetch-user: ?1
-   ReqHeader      sec-fetch-dest: document
-   ReqHeader      accept-language: pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7
-   ReqHeader      cookie: AMCVS_8F99160E571FC0427F000101%40AdobeOrg=1; s_cc=true
-   ReqHeader      X-Forwarded-For: 83.6.151.188,127.0.0.1
-   ReqHeader      grace: none
-   ReqHeader      Accept-Encoding: gzip
-   VCL_call       RECV
-   ReqUnset       grace: none
-   ReqHeader      grace: none
-   ReqURL         /
-   ReqUnset       Accept-Encoding: gzip
-   ReqHeader      Accept-Encoding: gzip
-   VCL_return     hash
-   VCL_call       HASH
-   VCL_return     lookup
-   Hit            557074 -3106.505552 259200.000000 0.000000
-   VCL_call       HIT
-   VCL_return     restart
-   VCL_Error      Too many restarts
-   RespProtocol   HTTP/1.1
-   RespStatus     503
-   RespReason     Service Unavailable
-   RespHeader     Date: Mon,26 Oct 2020 11:13:48 GMT
-   RespHeader     Server: Varnish
-   RespHeader     X-Varnish: 557088
-   VCL_call       SYNTH
-   RespHeader     Content-Type: text/html; charset=utf-8
-   RespHeader     Retry-After: 5
-   VCL_return     deliver
-   Timestamp      Process: 1603710828.024479 0.000262 0.000025
-   RespHeader     Content-Length: 280
-   Storage        malloc Transient
-   Filters        
-   RespHeader     Connection: close
-   Timestamp      Resp: 1603710828.024534 0.000317 0.000055
-   ReqAcct        763 0 763 205 280 485
-   End            
,

我将此代码添加到了我的default.vcl文件中:

import httpx
import asynctest
import pytest


class DebugClass:
    async def post(self):
        try:
            async with httpx.AsyncClient() as client:
                res = await client.post(url='http://localhost:8080',data=test_data)
            return "OK"
        except Exception as e:
            return "NOK"


@pytest.mark.asyncio
async def test_debug_class_post():
    with asynctest.patch('httpx.AsyncClient.post') as post_mock:
        post_mock.side_effect = TimeoutError
        debug_class = DebugClass()
        res = await debug_class.post()
        assert res == "NOK"

它似乎可以正常工作,目前没有503错误。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-