Skip to content

Instantly share code, notes, and snippets.

@mc256
Last active December 12, 2015 00:43
Show Gist options
  • Save mc256/9afb6bdeadb792e31d5e to your computer and use it in GitHub Desktop.
Save mc256/9afb6bdeadb792e31d5e to your computer and use it in GitHub Desktop.
nginx cache server
proxy_cache_path /var/www/cache/moegirl levels=1:2 keys_zone=moegirlproxy:20M inactive=1y max_size=20g;
#萌百压图反向代理
server {
listen 80;
listen [::]:80;
server_name img.rabbitcdn.com;
limit_conn limit_addr 30;
set $no_cache 0;
#set $no_cache 1;
location /{
proxy_pass http://img.rabbitcdn.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_temp_path /var/www/cache/proxy_temp 1 2;
proxy_cache_bypass $no_cache;
proxy_no_cache $no_cache;
proxy_cache moegirlproxy;
proxy_cache_valid 200 50d;
proxy_cache_min_uses 1;
proxy_cache_key $request_uri;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_503 http_403 http_404;
proxy_connect_timeout 90s;
proxy_send_timeout 90s;
proxy_read_timeout 90s;
}
}
#萌百压图反向代理
server {
listen 443;
listen [::]:443;
server_name api.rabbitcdn.com;
limit_conn limit_addr 30;
set $no_cache 0;
#set $no_cache 1;
location /{
proxy_pass http://api.rabbitcdn.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_temp_path /var/www/cache/proxy_temp 1 2;
proxy_cache_bypass $no_cache;
proxy_no_cache $no_cache;
proxy_cache moegirlproxy;
proxy_cache_valid 200 50d;
proxy_cache_min_uses 1;
proxy_cache_key $request_uri;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_503 http_403 http_404;
proxy_connect_timeout 90s;
proxy_send_timeout 90s;
proxy_read_timeout 90s;
}
ssl on;
ssl_certificate /etc/nginx/conf.d/ssl/api_rabbitcdn_com.crt;
ssl_certificate_key /etc/nginx/conf.d/ssl/api_rabbitcdn_com.key;
#enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#Disables all weak ciphers
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
}
#萌百压图反向代理
server {
listen 443;
listen [::]:443;
server_name crossfire.rabbitcdn.com;
limit_conn limit_addr 30;
set $no_cache 0;
#set $no_cache 1;
location /{
proxy_pass http://crossfire.rabbitcdn.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_temp_path /var/www/cache/proxy_temp 1 2;
proxy_cache_bypass $no_cache;
proxy_no_cache $no_cache;
proxy_cache moegirlproxy;
proxy_cache_valid 200 50d;
proxy_cache_min_uses 1;
proxy_cache_key $request_uri;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_503 http_403 http_404;
proxy_connect_timeout 90s;
proxy_send_timeout 90s;
proxy_read_timeout 90s;
}
ssl on;
ssl_certificate /etc/nginx/conf.d/ssl/crossfire_rabbitcdn_com.crt;
ssl_certificate_key /etc/nginx/conf.d/ssl/crossfire_rabbitcdn_com.key;
#enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#Disables all weak ciphers
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment