NGINX - Custom 502 Error Page

From Wiki.IT-Arts.net
Revision as of 19:37, 27 March 2020 by imported>Z
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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;

...