--- listen *:80;
+++ listen 80;
--- proxy_pass
+++ fastcgi_pass
set $php_admin_value "xcache.cacher=Off";
set $php_admin_value "$php_admin_value \n xcache.stat=Off";
set $php_admin_value "$php_admin_value \n xcache.optimizer Off";
fastcgi_param PHP_ADMIN_VALUE $php_admin_value;
http {
upstream storage_backend {
http://storage.example.com:80;
keepalive 256 single;
}
server {
listen 80;
server_name example.com;
# image serving location
location /images/ {
# images path
root /data/www;
# if there is no image - let's fetch it
error_page 404 = @fetch;
}
# image fetching location
location @fetch {
internal;
# passing request to storage
proxy_pass http://storage_backend;
# Saving image from storage
proxy_store on;
# Setting permissions
proxy_store_access user:rw group:rw all:r;
# Temporary directory for unfinished fetches
proxy_temp_path /data/temp;
# Image will be saving to this folder with "proxy_store -> on",
# so we just need to serve it as usual
root /data/www;
}
}
}</sorce>
http {
upstream storage_backend {
http://storage.example.com:80;
keepalive 256 single;
}
proxy_cache_path /opt/cache levels=1:2 keys_zone=images:256m inactive=4h max_size=20G;
server {
listen 80;
server_name example.com;
# image serving location
location /images/ {
# images path
root /data/www;
# if there is no image - let's fetch it
error_page 404 = @fetch;
}
# image fetching location
location @fetch {
internal;
# passing request to storage
proxy_pass http://storage_backend;
# setting up caching:
# - key for caching
proxy_cache_key $request_uri;
# - minimal request to store image in cache
proxy_cache_min_uses 7;
# - How long will valid response from storage will be valid, 4 days for example
proxy_cache_valid 200 4d;
}
}
}
# фовард приходящего "снаружи"
-t nat -A PREROUTING -d 5.5.5.5/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.10.10.110:80
# фовард приходящего "изнутри" ( опционально )
-t nat -A PREROUTING -d 10.10.10.1/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.10.10.110:80
$var = create_function('','return false;');
var_dump($var, is_string($var));
// string(9) "lambda_1"
// bool(true)
$var = function() {return false;};
var_dump($var, is_string($var));
$var = function() {return false;};
var_dump($var, is_string($var));
// object(Closure)#1 (0) {
// }
// bool(false)
$var = create_function('','return false;');
var_dump($var, function_exists($var), function_exists(''.$var), function_exists(trim($var)));
// string(9) "lambda_1"
// bool(true)
// bool(true)
// bool(false)
location /folder/ {
# основа: отдаем файлы и учетом аргументов
try_files $request_uri =404;
# вариация 1: для запроса file.html?a=b выдадим file.html, если он есть, если его нет проверим file.html?a=b и отдадим его или 404
try_files $uri $request_uri =404;
# вариация 2: для запроса file.html?a=b выдадим file.html?a=b, если он есть, если его нет проверим file.html и отдадим его или 404
try_files $uri $request_uri =404;
}