初次使用nginx,用nginx配置了反向代理,配置如下:
server
{
listen 80;
server_name localhost;
location ~/bbs/ {
proxy_redirect off;
proxy_set_header Host bbs.example.com:8771;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://bbs.example.com:8771;
}
}
想實(shí)現(xiàn) 造訪 www.example.com/bbs/ 就能代理到 http://bbs.example.com:8771 ,這樣設(shè)定也能正常存取。可是就是有個(gè)問題,論壇是jforum的,在論壇一回貼,網(wǎng)域就還是會(huì)跳轉(zhuǎn)回實(shí)際位址http://bbs.example.com:8771,猜測(cè)是「 proxy_set_header Host bbs.example.com:8771 ;” 這個(gè)地方的問題。還請(qǐng)大大們答疑解惑....
推薦看看這篇文章,是內(nèi)容替換的。
http://drops.wooyun.org/tips/6403