Commit 20e91fd8 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Pre-generate 404 page with initial theme during startup

parent a411dafa
Loading
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -23,18 +23,19 @@ server {
	# Add Cache-Control headers for static files, removed in *.php location
	add_header Cache-Control "public, max-age=7776000, stale-while-revalidate=86400, stale-if-error=604800";

	error_page 404 @not-found;
	error_page 502 /errors/502.html;
	error_page 404 /errors/generated/404.html;
	error_page 502 /errors/static/502.html;

	location /errors {
	location /errors/ {
		internal;
		alias /etc/nginx/html;

		location /errors/static/ {
			alias /etc/nginx/html/;
		}

	location @not-found {
		include fastcgi.conf;
		fastcgi_cache ERR;
		fastcgi_cache_valid 404 1d;
		location /errors/generated/ {
			alias /app/static/errors/;
		}
	}

	location @index {
+7 −0
Original line number Diff line number Diff line
@@ -223,6 +223,12 @@ collect_static()
		. static/
}

generate_static()
{
	mkdir -p static/errors
	wp eval 'get_template_part("404");' >static/errors/404.html
}

deactivate_missing_plugins()
{
	# Output active plugin entrypoints as a JSON array
@@ -299,6 +305,7 @@ case "$1" in
		setup_components
		setup_media
		collect_static
		generate_static
		timestamp "Completed Wordpress preparation"
		run_background_cron
		exec "$@" "${extra_args[@]}"