How to custom nginx as a forward proxy

as I know squid can be use a proxy server , but currently I don’t want
to use it , but want to use nginx ,I google "forward proxy " , and get
some idea :
add
server {
listen 8080;
resolver 8.8.8.8;
location / {
proxy_pass http://$http_host$request_uri;
}

but when I add the context to nginx.conf , and reload nginx

view the website such as
http://127.0.0.1:8080/www.yahoo.com get no response ,so can guys help me
:slight_smile:
thanks.

Posted at Nginx Forum:

access log like this , but the webpage has no any infomation shown.

127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.1”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”
127.0.0.1 - - [26/Mar/2012:10:28:54 +0500] “GET /www.yahoo.com HTTP/1.0”
499 0 “-” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)”

Posted at Nginx Forum: