I have problem with "Error 503 Service Unavailable" Error is showing after 24 hours. I am using varnish-6.5.1 for full page cache with newest nginx serwer. Magento version is 2.3.4. I am using SSL certificate and Magento is in developer mode.
My varnish configuration look like this:
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
My nginx configuration looks like this:
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;
}
How can I check what is causing the error?
2
Answers
I used command
And error is "Too many restarts" Below I have paste full log
I added this code to my default.vcl file:
It seems to work, no 503 error for now.