Nginx – Error 503 Service Unavailable Varnish/Nginx/SSL

nginxsslvarnish

I have a setup where Nginx and Varnish are just working fine. Multiple website running on one VPS. Nginx runs on port 8080.

I added a SSL certificate to one of the websites to run it in https but after configuration I receive this error when browsing the site in https:

Error 503 Service Unavailable

Service Unavailable
Guru Meditation:

XID: 613157718

My nginx config for this site is (partly):

server {

    listen 443 ssl;

    server_name mydomain.com www.mydomain.com;

    root /srv/www/www.mydomain.com;
    index index.php index.html index.htm;

    ssl_certificate /etc/nginx/ssl/mydomain/ssl-bundle.crt;
    ssl_certificate_key /etc/nginx/ssl/mydomain/certificate.key;

    location / {
    proxy_pass  http://127.0.0.1:80;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Forwarded-Port 443;
    proxy_set_header X-Secure on;
}

}

Any ideas?

Cheers,
Jaap

Best Answer

Your setup is Nginx -> Varnish -> Apache right?

The "Guru Meditation" error is from Varnish, which means the request is making it as far as Varnish, but Varnish is having problems processing the request.

If you run the "varnishlog" on the server, it will start outputting lots of information about each request. Then in your browser make an https request then once you get the error message, use ctrl-c to stop varnishlog from outputting anything else. Scroll up through the output and you should find a line or two telling you what problem Varnish had in processing the request.