Magento2 – Fix 503 Service Temporarily Unavailable Error

magento2nginx

I was trying to print an order collection array (\Magento\Sales\Model\ResourceModel\Order\CollectionFactory), but it never gets printed, I know the reason.

Now when I reload my browser, I get a 503 Service Temporarily Unavailable everywhere, frontend and backend.

There is no maintenance.flag or even .maintenance.flag anywhere in var/ folder.

Mode – developer,
Hosted on NGINX, plesk (other sites on same server working). I tried deleting cache, indexing, static contents deploy everything.

The error in /var/log/nginx/error.log is:

2018/02/22 11:36:56 [notice] 9870#0: signal process started
2018/02/22 11:36:56 [error] 9870#0: open() "/var/run/nginx.pid" failed (2: No such file or directory)

Kindly help!

Best Answer

Reload your NginX configuration:

If your system has systemctl

sudo systemctl reload nginx

If your system supports service (using debian/ubuntu) try this

sudo service nginx reload

If not (using centos/fedora/etc) you can try the init script

sudo /etc/init.d/nginx reload

Please make sure that you reload and not restart.

  • Reloading keeps the server running while re-reading any configuration file updates.

  • Reloading is safer than restarting because if a syntax error is noticed in a config file, it will not proceed with the reload and your server remains running.

  • If there is a syntax error in a config file and you restart, it's possible the server will not restart correctly.

Related Topic