Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Figuring out how to make nginx store information.

$
0
0
Heres what im doing. A site created a code for catching steam games blizzard games and smite. What i'm trying to do is add on to it. As far as iv'e got im trying tera and wildstar. I can make the data pass through the proxy but, its not storeing the data. League also doesnt work but, If I can have someone inform me how they can fix this I can understand and add more games to this list and pass this file around to more lan centers.


# LANCache By Matt Hohman November 2013
# http://churchnerd.net/2013/11/introducing-lancache/
#
#
# Based on "Valve Steam Pipe Reverse Proxy Configuration by Brian Astrolox Wojtczak"
# http://www.astrolox.com/2013/05/31/valve-steampipe-reverse-proxy/
# AND
# Steven Hartland at Multiplay
# http://blog.multiplay.co.uk/2013/04/caching-steam-downloads-lans/
#
#######################################################################
#
#YOU WILL NEED TO CONSULT THE MOST RECENT DNS CONFIGURATION AT
# http://churchnerd.net/2013/11/introducing-lancache/
#
#######################################################################


user www-data;
#This should be 2*CPU Cores
worker_processes 8;
pid /var/run/nginx.pid;

events {
worker_connections 19000;
multi_accept on;

# kqueue (FreeBSD 4.1+), epoll (Linux 2.6+), rt signals (Linux 2.2.19+)
# /dev/poll (Solaris 7 11/99+), event ports (Solaris 10), select, and poll
use epoll;
#use kqueue;
}

http {
include mime.types;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
keepalive_timeout 65;

#Set this to a reginal DNS server (NOT THE DNS FORWARD)
resolver 8.8.8.8;
resolver_timeout 30s;



proxy_cache_path /var/www/cache/CS levels=1:2 keys_zone=CS:10m
inactive=72h max_size=1g;

proxy_cache_path /var/www/cache/L3 levels=1:2 keys_zone=L3:10m
inactive=72h max_size=1g;

proxy_cache_path /var/www/cache/OTHER levels=2:2 keys_zone=OTHER:100m
inactive=72h max_size=1g;

proxy_cache_key "$scheme$host$request_uri$cookie_user";

# Prevent steam crash logs from being submitted to valve .
server {
listen *:80;
server_name 192.168.70.99 crash.steampowered.com;

location / {
satisfy all;
deny all;

access_log /var/log/nginx/crash.steampowered.com-access.log;
error_log /var/log/nginx/crash.steampowered.com-error.log;
}
}

# Cache the main steam content servers - this is the important bit
server {
listen *:80;
server_name 192.168.70.99 *.cs.steampowered.com;

access_log /var/log/nginx/cs.steampowered.com-access.log;
error_log /var/log/nginx/cs.steampowered.com-error.log;

root /var/www/cs.steampowered.com/;

location /depot/ {
try_files $uri @mirror1;
access_log /var/log/nginx/cs.steampowered.com-access-depot-local.log;
}

location / {
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;

access_log /var/log/nginx/cs.steampowered.com-access-other.log;
}

location @mirror1 {
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;

access_log /var/log/nginx/cs.steampowered.com-access-depot-remote.log;
}
}

# All non game content server content can be cached here,
# as long as DNS is pointing at this nginx server.
server {
listen *:80;
server_name 192.168.70.99 *.steampowered.com;

access_log /var/log/nginx/steampowered.com-access.log;
error_log /var/log/nginx/steampowered.com-error.log;

location / {
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_cache OTHER;
proxy_cache_valid 200 301 302 10m;
proxy_cache_valid any 1m;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;
}
}




#
#Cache Riotgames CDN
#
server {
listen *:80;
server_name 192.168.70.99 l3cdn.riotgames.com;

access_log /var/log/nginx/l3cdn.riotgames.com-access.log;
error_log /var/log/nginx/l3cdn.riotgames.com-error.log;

root /var/www/l3cdn.riotgames.com/;

location / {
try_files $uri @l3cdn;
access_log /var/log/nginx/l3cdn.riotgames.com-access-local.log;
}




location @l3cdn {
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;

access_log /var/log/nginx/l3cdn.riotgames.com-access-remote.log;
}
}

#Create a limit zone for blizzard based on requested file name
limit_zone one $uri 10m;

#Cache Blizzards Edgesuite CDN
#Note: First request for each file will be cached
#Additional range requests for each file will be passed to oringinal server until first request is fully downloaded

server {
listen *:80;
server_name 192.168.70.99 dist.blizzard.com.edgesuite.net;

access_log /var/log/nginx/dist.blizzard.com.edgesuite.net-access.log;
error_log /var/log/nginx/dist.blizzard.com.edgesuite.net-error.log;

root /var/www/blizzard.com/;
location / {
try_files $uri @es-cache;
access_log /var/log/nginx/blizzard.com-local.log;
}


location @es-cache {
limit_conn one 1;
error_page 503 = @es-pass;
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;
proxy_pass_request_headers off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;

access_log /var/log/nginx/blizzard.com-cache-remote.log;


}

location @es-pass {
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;

access_log /var/log/nginx/blizzard.com-pass-remote.log;


}






}

#Cache Blizzards llnw CDN
#Note: First request for each file will be cached
#Additional range requests for each file will be passed to oringinal server until first request is fully downloaded
server {
listen *:80;
server_name 192.168.70.99 llnw.blizzard.com;

access_log /var/log/nginx/llnw.blizzard.com-access.log;
error_log /var/log/nginx/llnw.blizzard.com-error.log;




root /var/www/blizzard.com/;
location / {
try_files $uri @llnw-cache;
access_log /var/log/nginx/blizzard.com-local.log;
}



location @llnw-cache {
limit_conn one 1;
error_page 503 = @llnw-pass;
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;
proxy_pass_request_headers off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;

access_log /var/log/nginx/blizzard.com-cache-remote.log;


}
location @llnw-pass {


proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;

access_log /var/log/nginx/blizzard.com-pass-remote.log;


}





}
#Cache Blizzards Game Installers


server {
listen *:80;
server_name 192.168.70.99 dist.blizzard.com;

access_log /var/log/nginx/dist.blizzard.com-access.log;
error_log /var/log/nginx/dist.blizzard.com-error.log;

root /var/www/dist.blizzard.com/;
location / {
#first try local then download the file 1x from original server then pass through the 206 chunks
try_files $uri @blizzard-install;
access_log /var/log/nginx/dist.blizzard.com-local.log;
}

location @blizzard-install {
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;
}


}







#
#Cache wildstar
#
server {
listen *:80;
server_name 192.168.70.99 wildstar.patcher.ncsoft.com;

access_log /var/log/nginx/wildstar.patcher.ncsoft.com-access.log;
error_log /var/log/nginx/wildstar.patcher.ncsoft.com-error.log;

root /var/www/wildstar.patcher.ncsoft.com/;

location / {
try_files $uri @wildstar;
access_log /var/log/nginx/wildstar.patcher.ncsoft.com-access-local.log;
}




location @wildstar {
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;

access_log /var/log/nginx/wildstar.patcher.ncsoft.com-access-remote.log;
}
}



#Cache tera Studios internap
server {
listen *:80;
server_name 192.168.70.99 patch.tera.enmasse-game.com;

access_log /var/log/nginx/patch.tera.enmasse-game.com;
error_log /var/log/nginx/patch.tera.enmasse-game.com;

root /var/www/patch.tera.enmasse-game.com;
location / {

try_files $uri @internap;
access_log /var/log/nginx/patch.tera.enmasse-game.com-local.log;
}

location @internap {
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;
access_log /var/log/nginx/patch.tera.enmasse-game.com-remote.log;
}


}



#Cache Hi-Rez Studios hwcdn
server {
listen *:80;
server_name 192.168.70.99 *.hwcdn.net;

access_log /var/log/nginx/hwcdn.net-access.log;
error_log /var/log/nginx/hwcdn.net-error.log;

root /var/www/hi-rez;
location / {

try_files $uri @hwcdn;
access_log /var/log/nginx/hwcdn.net-local.log;
}

location @hwcdn {
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;
access_log /var/log/nginx/hwcdn.net-remote.log;
}


}












#Cache Hi-Rez Studios internap
server {
listen *:80;
server_name 192.168.70.99 hirez.http.internapcdn.net;

access_log /var/log/nginx/hirez.http.internapcdn.net-access.log;
error_log /var/log/nginx/hirez.http.internapcdn.net-error.log;

root /var/www/hi-rez;
location / {

try_files $uri @internap;
access_log /var/log/nginx/hirez.http.internapcdn.net-local.log;
}

location @internap {
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;
access_log /var/log/nginx/hirez.http.internapcdn.net-remote.log;
}


}





# Serve up default web root folder for unrecognised hosts, you
# should put something informative here, such as an error message.
server {
listen *:80 default;

location / {
root /var/www/;

add_header Host $host;
}
}









}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>