Ubuntu下配置nginx作为http代理服务器

修改/etc/nginx/sites-available下的default文件内容为:

server {
  server_name 42.121.107.174;
  resolver 8.8.8.8;
  resolver_timeout 5s;
  location / {
    proxy_pass $scheme://$host$request_uri;
    proxy_set_header Host $http_host;

    proxy_buffers 256 8k;
    proxy_max_temp_file_size 0;

    proxy_connect_timeout 30;

    proxy_cache_valid 200 302 10m;
    proxy_cache_valid 301 1h;
    proxy_cache_valid any 1m;
  }
}

 

-------

重新加载nginx: nginx -s reload

posted on 2013-02-18 16:39  misoag  阅读(653)  评论(0编辑  收藏  举报

导航