NGINX - Custom 502 Error Page

From Wiki.IT-Arts.net


Adapt /etc/nginx/sites-available/example.com.conf like:

server {
	listen W.X.Y.Z:443 ssl;
	server_name example.com;

	if ($host = 'www.example.com' ) {
		rewrite  ^/(.*)$  https://example.com/$1  permanent;
	}
 
	access_log  /var/log/nginx/example.com.access.log;
	error_log  /var/log/nginx/example.com.error.log;
	
	error_page 502 /custom_502_error.html;
	location = /custom_502_error.html {
		internal;
		root /usr/share/nginx/html;
	}

#	root   /usr/share/nginx/html;
	index  index.html index.htm;

...