Quick n dirty reverse proxy setup

From XinCheJian
Jump to navigation Jump to search

nginx 1.x

needed to update the rpm for centos since 1.x still isn't in the repos yet.. but took from here: http://nginx.org/en/download.html

i'm running apache infront of mine since it's my main webserver, but here is what i got setup..

thats nginx inside the conf.d folder

  proxy_cache_path  /var/www/cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m;
  proxy_temp_path /var/www/cache/tmp; 


  server {
listen	 127.0.0.1:8888;
    location / {
      proxy_pass http://xinchejian.com;
      proxy_cache my-cache;
      proxy_cache_valid  200 302  60m;
      proxy_cache_valid  404      1m;
    }
  }


if you dont have a webserver then this would be for you since nginx already listens on port 80 in /etc/nginx/conf.d/default.conf:

  proxy_cache_path  /var/www/cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m;
  proxy_temp_path /var/www/cache/tmp; 

  server {
    location / {
      proxy_pass http://xinchejian.com;
      proxy_cache my-cache;
      proxy_cache_valid  200 302  60m;
      proxy_cache_valid  404      1m;
    }
  }