以下是我们目前在应用程序上的设置
但我们想添加nginx作为一个反向代理caching非常像鱿鱼或清漆是否有可能编辑这个configuration来启用caching行为,或者我需要添加另一个nginx在这个设置之前就像我会为鱿鱼或漆
如果这样做可以不使用鱿鱼和清漆,那么在nginx中进行完整的设置会很好
非常感谢
upstream backend_appname{ #start1.someserver.com server start1.someserver.com:7810 fail_timeout=3s; server start1.someserver.com:7811 fail_timeout=3s; server start1.someserver.com:7812 fail_timeout=3s; server start1.someserver.com:7813 fail_timeout=3s; } server { server_name appname.someserver.com; listen 80; access_log logs/access_appname.log; #error_log logs/error_appname.log; location /nginx_status { stub_status on; access_log off; } location /static { root /home/someuser/work/appname; expires max; add_header Cache-Control public,max-age=604800,post-check=604800,pre-check=1209600; } location / { root /home/someuser/work/appname; fastcgi_pass backend_appname; set $addr $remote_addr; if ($http_x_forwarded_for ~ "(?:^|,)\s*(\d+\.\d+\.\d+\.\d+)\s*$") { set $addr $1; } fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REMOTE_ADDR $addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; } }
您可以使用nginx作为caching逆向代理。 以下链接将有所帮助。
http://staff.adams.edu/~cdmiller/posts/nginx-reverse-proxy-cache/
http://staff.adams.edu/~cdmiller/posts/nginx-reverse-proxy-cache/
我build议使用Varnish,因为它是一个反向代理,并且可以比Nginx更快地执行该function。
清漆是为了performance而调整的。 它做的疯狂的东西,如编译它的configuration文件到C对象,然后将其加载到它的内存。 这可能看起来并不多,但是当你在configuration中定义了一些逻辑(通过Varnish自己的VCL语言,本身很酷),它确实会有所作为。
我知道你在做什么,bu nginx并不是一个单一的程序,它可以完成所有的事情(不像apache)。 这意味着要做一些事情,并做好这些事情……如果有更好的反向代理(Varnish),请改用它!
只是我的想法:)