From 9fab9307b6ab464e99addabb3916a4c3ce1c244c Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 13 Dec 2022 14:40:00 +0300 Subject: [PATCH] + uploads_upstream conf --- config/nginx/conf.d/vhosts.conf.example | 6 ++ config/nginx/conf.d/z-wordpress.conf.example | 112 +++++++++++++-------------- 2 files changed, 60 insertions(+), 58 deletions(-) diff --git a/config/nginx/conf.d/vhosts.conf.example b/config/nginx/conf.d/vhosts.conf.example index 9dbc442..51be55f 100644 --- a/config/nginx/conf.d/vhosts.conf.example +++ b/config/nginx/conf.d/vhosts.conf.example @@ -17,6 +17,12 @@ map $http_accept $webp_suffix { "~*webp" ".webp"; } +resolver 8.8.8.8; + +map $http_host $uploads_upstream { + wordpress.ru.local.wpstudio.ru "https://somewp.site"; +} + server { server_name octobercms.ru.local.wpstudio.ru diff --git a/config/nginx/conf.d/z-wordpress.conf.example b/config/nginx/conf.d/z-wordpress.conf.example index 6289598..a01252d 100644 --- a/config/nginx/conf.d/z-wordpress.conf.example +++ b/config/nginx/conf.d/z-wordpress.conf.example @@ -1,67 +1,63 @@ server { - server_name - wp-with-file-proxy.local.wpstudio.ru - ; - listen 80; - root $root; - index index.html index.htm index.php; - location / { - try_files $uri $uri/ /index.php?$args; - } - rewrite /wp-admin$ $scheme://$host$uri/ permanent; - location ~* ^/wp-content/uploads/.*$ { - expires max; - proxy_pass $uploads_upstream; - } - location ~* ^/uploads/.*$ { - expires max; - proxy_pass $uploads_upstream; - } - location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { - access_log off; - } - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - if (!-f $document_root$fastcgi_script_name) { - return 404; + server_name + wp-with-file-proxy.local.wpstudio.ru + ; + listen 80; + root $root; + index index.html index.htm index.php; + location / { + try_files $uri $uri/ /index.php?$args; } - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + rewrite /wp-admin$ $scheme://$host$uri/ permanent; + location ~* ^/wp-content/uploads/.*$ { + expires max; + proxy_pass $uploads_upstream; + } + location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { + access_log off; + } + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; - fastcgi_pass fpm74; - fastcgi_index index.php; - fastcgi_read_timeout 3000; - } + fastcgi_pass fpm74; + fastcgi_index index.php; + fastcgi_read_timeout 3000; + } } server { - server_name - wp.local.wpstudio.ru - ; - listen 80; - root $root; - index index.html index.htm index.php; - location / { - try_files $uri $uri/ /index.php?$args; - } - rewrite /wp-admin$ $scheme://$host$uri/ permanent; - location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { - access_log off; - } - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - if (!-f $document_root$fastcgi_script_name) { - return 404; + server_name + wp.local.wpstudio.ru + ; + listen 80; + root $root; + index index.html index.htm index.php; + location / { + try_files $uri $uri/ /index.php?$args; } - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + rewrite /wp-admin$ $scheme://$host$uri/ permanent; + location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { + access_log off; + } + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; - fastcgi_pass fpm74; - fastcgi_index index.php; - fastcgi_read_timeout 3000; - } + fastcgi_pass fpm74; + fastcgi_index index.php; + fastcgi_read_timeout 3000; + } }