Skip to content

Instantly share code, notes, and snippets.

@base698
Created August 24, 2016 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save base698/eb530ee6750cb9bed98b3340cd26c518 to your computer and use it in GitHub Desktop.
Save base698/eb530ee6750cb9bed98b3340cd26c518 to your computer and use it in GitHub Desktop.
nginx Built with: ./configure --add-module=../memc-nginx-module/ --add-module=../ngx_devel_kit/ --add-module=../set-misc-nginx-module/ --add-module=../redis2-nginx-module/ --add-module=../srcache-nginx-module/ --add-module=../echo-nginx-module/ --add-module=../ngx_http_redis-0.3.8
#user nobody;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
error_log /var/log/nginx/nginx_error.log warn;
error_log /var/log/nginx/nginx_error.log info;
http {
upstream backend {
server localhost:3000;
#server localhost:3001;
}
upstream redis {
server localhost:6379;
}
upstream my_memcached {
server localhost:11211;
keepalive 10;
}
server {
listen 80;
location = /redis {
internal ;
set $redis_key $args;
set_md5 $redis_key;
#redis2_query get $redis_key
redis_pass redis;
}
location = /redis2 {
internal ;
set_unescape_uri $exptime $arg_exptime;
set_unescape_uri $key $arg_key;
set_md5 $key;
redis2_query set $key $echo_request_body;
redis2_query expire $key $exptime;
redis2_pass redis;
}
location = /memc {
internal;
memc_connect_timeout 100ms;
memc_send_timeout 100ms;
memc_read_timeout 100ms;
memc_ignore_client_abort on;
set $memc_key $query_string;
set $memc_exptime 300;
memc_pass my_memcached;
}
# working redis
#location /users {
#set $key "cache:$http_authorization:$request_uri";
# default_type text/css;
#srcache_res#ponse_cache_control off;
#srcache_ignore_content_encoding on;
#set_escape_uri $escaped_key $key;
#srcache_fetch GET /redis $key;
#srcache_store PUT /redis2 key=$escaped_key&exptime=1500;
#proxy_pass http://backend;
#}
location /users {
set $key "cache:$http_authorization:$request_uri";
srcache_fetch GET /memc $key;
srcache_store PUT /memc $key;
srcache_store_statuses 200 301 302;
proxy_pass http://backend;
}
}
}
#http {
#include mime.types;
#default_type application/octet-stream;
##log_format main '$remote_addr - $remote_user [$time_local] "$request" '
## '$status $body_bytes_sent "$http_referer" '
## '"$http_user_agent" "$http_x_forwarded_for"';
##access_log logs/access.log main;
#sendfile on;
##tcp_nopush on;
##keepalive_timeout 0;
#keepalive_timeout 65;
##gzip on;
#server {
#listen 8080;
#server_name localhost;
##charset koi8-r;
##access_log logs/host.access.log main;
#location / {
#root html;
#index index.html index.htm;
#}
##error_page 404 /404.html;
## redirect server error pages to the static page /50x.html
##
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
#root html;
#}
## proxy the PHP scripts to Apache listening on 127.0.0.1:80
##
##location ~ \.php$ {
## proxy_pass http://127.0.0.1;
##}
## pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
##
##location ~ \.php$ {
## root html;
## fastcgi_pass 127.0.0.1:9000;
## fastcgi_index index.php;
## fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
## include fastcgi_params;
##}
## deny access to .htaccess files, if Apache's document root
## concurs with nginx's one
##
##location ~ /\.ht {
## deny all;
##}
#}
## another virtual host using mix of IP-, name-, and port-based configuration
##
##server {
## listen 8000;
## listen somename:8080;
## server_name somename alias another.alias;
## location / {
## root html;
## index index.html index.htm;
## }
##}
## HTTPS server
##
##server {
## listen 443 ssl;
## server_name localhost;
## ssl_certificate cert.pem;
## ssl_certificate_key cert.key;
## ssl_session_cache shared:SSL:1m;
## ssl_session_timeout 5m;
## ssl_ciphers HIGH:!aNULL:!MD5;
## ssl_prefer_server_ciphers on;
## location / {
## root html;
## index index.html index.htm;
## }
##}
#}
include servers/*;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment