Commit 0b523b93 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Simplify fastcgi in nginx config

parent fec3fcb8
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4,7 +4,8 @@ ARG nginx_version=latest
FROM nginx:${nginx_version} as nginx
LABEL uk.org.kodo.maintainer = "Dom Sekotill <dom.sekotill@kodo.org.uk>"
COPY data/nginx.conf /etc/nginx/conf.d/default.conf
COPY data/fastcgi.nginx.conf /etc/nginx/fastcgi_params
COPY data/fastcgi.nginx.conf /etc/nginx/fastcgi.conf
COPY data/cache-bust.nginx.conf /etc/nginx/cache-bust.conf
COPY data/5*.html /app/html/


+1 −0
Original line number Diff line number Diff line
add_header X-Clacks-Overhead "GNU Terry Pratchett";
+2 −0
Original line number Diff line number Diff line
fastcgi_pass upstream:9000;

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
+14 −18
Original line number Diff line number Diff line
@@ -36,26 +36,22 @@ server {
		internal;

		location /errors/404 {
			include fastcgi_params;
			fastcgi_pass upstream:9000;
			include fastcgi.conf;
			fastcgi_param SCRIPT_FILENAME /app/index.php;
			fastcgi_cache ERR;
			fastcgi_cache_valid 404 1d;
		}
	}

	location /index.php {
		include fastcgi_params;
		fastcgi_pass upstream:9000;
		add_header X-Clacks-Overhead "GNU Terry Pratchett";
	location @index {
		include fastcgi.conf;
		include cache-bust.conf;
		fastcgi_param SCRIPT_FILENAME /app/index.php;
	}

	location = /.probe {
		fastcgi_pass upstream:9000;
		include fastcgi.conf;
		fastcgi_param SCRIPT_NAME /.probe;
		fastcgi_param SCRIPT_FILENAME /.probe;
		fastcgi_param REQUEST_METHOD GET;
		add_header X-Clacks-Overhead "GNU Terry Pratchett";
		access_log off;
	}

@@ -73,19 +69,20 @@ server {

	# allow the new JSON REST API
	location /wp-json/ {
		rewrite ^ /index.php$is_args$args last;
		include fastcgi.conf;
		include cache-bust.conf;
		fastcgi_param SCRIPT_FILENAME /app/index.php;
	}

	# use /index.php as a front controller if the base of the URI path does
	# not exist
	location / {
		try_files $uri /index.php$is_args$args;
		try_files $uri @index;
	}

	location = /wp-login.php {
		include fastcgi_params;
		fastcgi_pass upstream:9000;
		add_header X-Clacks-Overhead "GNU Terry Pratchett";
		include fastcgi.conf;
		include cache-bust.conf;
	}

	# wp-admin uses lots of directly accessed PHP scripts, unfortunately
@@ -96,9 +93,8 @@ server {
		try_files $uri $uri/index.php;

		location ~ \.php$ {
			include fastcgi_params;
			fastcgi_pass upstream:9000;
			add_header X-Clacks-Overhead "GNU Terry Pratchett";
			include fastcgi.conf;
			include cache-bust.conf;
		}
	}