From 939e049fc1e0ec611ad730f0ac66a085b5993969 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 24 Feb 2025 00:09:57 +0000 Subject: [PATCH] Changes specific to empirereportnewyork.com --- global/http.conf | 16 +++++++++++++++- global/php-pool.conf | 2 +- global/server/defaults.conf | 4 +++- global/server/fastcgi-cache.conf | 2 +- global/server/static-files.conf | 2 +- modules-available | 1 + nginx.conf | 2 ++ upstreams/php74.conf | 4 ++++ upstreams/php81.conf | 4 ++++ 9 files changed, 32 insertions(+), 5 deletions(-) create mode 120000 modules-available create mode 100644 upstreams/php74.conf create mode 100644 upstreams/php81.conf diff --git a/global/http.conf b/global/http.conf index faf1e6d..25d99e1 100644 --- a/global/http.conf +++ b/global/http.conf @@ -5,4 +5,18 @@ sendfile on; tcp_nopush on; # Don't wait to send data in keep-alive state. -tcp_nodelay on; \ No newline at end of file +tcp_nodelay on; + + +map $http_user_agent $user_type { + default "desktop"; + # Android + "~Mozilla/5.0 \(Linux; Android" mobile; + # Opera + "~Opera Mini" mobile; + # iOS + "~Mozilla/5.0 \(iPhone" mobile; + # Windows Phone + "~Mozilla/5.0 \(Windows Phone" mobile; +} + diff --git a/global/php-pool.conf b/global/php-pool.conf index 4f87b7a..788947c 100644 --- a/global/php-pool.conf +++ b/global/php-pool.conf @@ -9,5 +9,5 @@ include /etc/nginx/upstreams/*.conf; map '' $upstream { - default php73; + default php81; } diff --git a/global/server/defaults.conf b/global/server/defaults.conf index 2cad123..77e05e8 100644 --- a/global/server/defaults.conf +++ b/global/server/defaults.conf @@ -8,4 +8,6 @@ include global/server/exclusions.conf; include global/server/security.conf; # Static Content -include global/server/static-files.conf; \ No newline at end of file +include global/server/static-files.conf; +rewrite /sitemap_index.xml$ /index.php?sitemap=1 last; +rewrite /([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; diff --git a/global/server/fastcgi-cache.conf b/global/server/fastcgi-cache.conf index 8079ac2..fb681a6 100644 --- a/global/server/fastcgi-cache.conf +++ b/global/server/fastcgi-cache.conf @@ -1,5 +1,5 @@ # The key to use when saving cache files, which will run through the MD5 hashing algorithm. -fastcgi_cache_key "$scheme$request_method$host$request_uri"; +fastcgi_cache_key "$scheme$request_method$host$user_type$request_uri"; # If an error occurs when communicating with FastCGI server, return cached content. # Useful for serving cached content if the PHP process dies or timeouts. diff --git a/global/server/static-files.conf b/global/server/static-files.conf index aeea70c..6298ddc 100644 --- a/global/server/static-files.conf +++ b/global/server/static-files.conf @@ -37,4 +37,4 @@ location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ { location = /robots.txt { access_log off; log_not_found off; -} \ No newline at end of file +} diff --git a/modules-available b/modules-available new file mode 120000 index 0000000..9b739bb --- /dev/null +++ b/modules-available @@ -0,0 +1 @@ +/usr/share/nginx/modules \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index d7b809a..417acdd 100644 --- a/nginx.conf +++ b/nginx.conf @@ -12,6 +12,8 @@ worker_rlimit_nofile 8192; # File that stores the process ID. Rarely needs changing. pid /run/nginx.pid; +load_module modules/ngx_http_cache_purge_module.so; + events { # Set the maximum number of connection each worker process can open. Anything higher than this # will require Unix optimisations. diff --git a/upstreams/php74.conf b/upstreams/php74.conf new file mode 100644 index 0000000..0d8b4ce --- /dev/null +++ b/upstreams/php74.conf @@ -0,0 +1,4 @@ +# Defines the upstream for PHP 7.0 +upstream php74 { + server unix:/run/php/php7.4-fpm.sock; +} diff --git a/upstreams/php81.conf b/upstreams/php81.conf new file mode 100644 index 0000000..d5dff6a --- /dev/null +++ b/upstreams/php81.conf @@ -0,0 +1,4 @@ +# Defines the upstream for PHP 7.0 +upstream php81 { + server unix:/run/php/php8.1-fpm.sock; +}