一、nginx配合memcache缓存资源
![image.png](https://static.studygolang.com/181031/cc1384490b85f392ba5cda304f0d5684.png)
配置实例:
upstream memcacheds {
server 10.1.240.166:22222;
}
server {
listen 8080;
server_name nm.ttlsa.com;
index index.html index.htm index.php;
root /data/wwwroot/test.ttlsa.com/webroot;
location /images/ {
set $memcached_key $request_uri;
add_header X-mem-key $memcached_key;
memcached_pass memcacheds;
default_type text/html;
error_page 404 502 504 = @app;
}
location @app {
rewrite ^/.* /nm_ttlsa.php?key=$request_uri;
}
location ~ .*\.php?$
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:10081;
fastcgi_index index.php;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
有疑问加站长微信联系(非本文作者))