1

So as I said, I am trying to see my website while others see it in maintenance. BTW I have Varnish configured.

What I did:

magento maintenance:enable --ip=<my-ip-address>

What hapened:

  1. At first I was able to see only frontend from excluded IP, but admin was regular "Service temporary unavailable" page.

  2. Than I red about maintenance.flag in var and how it is what causes maintenance mode. So I deleted it to deactivate maintenance and again created it with touch. After that frontend was also unavailable from my excluded IP.

System:

  • nginx
  • magento 2.3.3
  • mariadb 10.*
  • php 7.2
  • Varnish [latest as of today]

I followed official magento 2 installation guide along with this for setup of varnish and letsencrypt.

I gathered from other questions that it is problem with varnish and it can be fixed with forwarding headers, but not sure how to do this on Nginx server.

0

This is because of varnish so make nginx aware that you are behind the varnish.

  1. Add these 2 lines in your /etc/nginx/nginx.conf file

    set_real_ip_from 127.0.0.1; #Put the Ip of your varnish/proxy here real_ip_header X-Forwarded-For; #Put the Header that your varnish/proxy set

  2. Also add below rule (usually /etc/varnish/default.vcl), in the vcl_recv part

    set req.http.X-Forwarded-For = client.ip;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.