+ uploads_upstream conf

This commit is contained in:
2022-12-13 14:40:00 +03:00
parent 71d4b97c46
commit 9fab9307b6
2 changed files with 60 additions and 58 deletions

View File

@ -17,6 +17,12 @@ map $http_accept $webp_suffix {
"~*webp" ".webp"; "~*webp" ".webp";
} }
resolver 8.8.8.8;
map $http_host $uploads_upstream {
wordpress.ru.local.wpstudio.ru "https://somewp.site";
}
server { server {
server_name server_name
octobercms.ru.local.wpstudio.ru octobercms.ru.local.wpstudio.ru

View File

@ -1,67 +1,63 @@
server { server {
server_name server_name
wp-with-file-proxy.local.wpstudio.ru wp-with-file-proxy.local.wpstudio.ru
; ;
listen 80; listen 80;
root $root; root $root;
index index.html index.htm index.php; index index.html index.htm index.php;
location / { location / {
try_files $uri $uri/ /index.php?$args; 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;
} }
include fastcgi_params; rewrite /wp-admin$ $scheme://$host$uri/ permanent;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; location ~* ^/wp-content/uploads/.*$ {
fastcgi_param PATH_INFO $fastcgi_path_info; expires max;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 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_pass fpm74;
fastcgi_index index.php; fastcgi_index index.php;
fastcgi_read_timeout 3000; fastcgi_read_timeout 3000;
} }
} }
server { server {
server_name server_name
wp.local.wpstudio.ru wp.local.wpstudio.ru
; ;
listen 80; listen 80;
root $root; root $root;
index index.html index.htm index.php; index index.html index.htm index.php;
location / { location / {
try_files $uri $uri/ /index.php?$args; 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;
} }
include fastcgi_params; rewrite /wp-admin$ $scheme://$host$uri/ permanent;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 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)$ {
fastcgi_param PATH_INFO $fastcgi_path_info; access_log off;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; }
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_pass fpm74;
fastcgi_index index.php; fastcgi_index index.php;
fastcgi_read_timeout 3000; fastcgi_read_timeout 3000;
} }
} }