Nginx proxy Settings

Source: Internet
Author: User

Imagine the need to visit Google

[[email protected] vhosts] #vim/usr/local/nginx/conf/vhosts/proxy.conf

server {

Listen 80;

server_name www.baidu.com;

Location/{

Proxy_pass http://180.97.33.107/; #百度的IP

#proxy_set_header Host $host;

}

}

--------------------------

Access test

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/8B/1A/wKioL1hFBcXBQFQvAATeWas4TN8156.jpg "title=" Ng35.jpg "alt=" Wkiol1hfbcxbqfqvaatewas4tn8156.jpg "/>

-----------------------------------------------------------------

Nginx Test Load Balancing: Use the dig command to find another Baidu IP

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/8B/1E/wKiom1hFBtfRRhyKAAFbiSngDSI848.jpg "title=" Ng36.jpg "alt=" Wkiom1hfbtfrrhykaafbisngdsi848.jpg "/>

[[email protected] vhosts] #vim/usr/local/nginx/conf/vhosts/proxy.conf


Upstream baidu{

Server 180.97.33.108:80;

Server 180.97.33.107;

}

server {

Listen 80;

server_name www.baidu.com;


Location/{

Proxy_pass http://baidu/;

Proxy_set_header Host $host; # This line will not open, otherwise the visit would be reported 502

#proxy_set_header X-real-ip $remote _addr;

}

}

-------------------------------------


650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/8B/1B/wKioL1hFCVWAE0PJAAOKeO3N3Mg335.jpg "title=" Ng36.jpg "alt=" Wkiol1hfcvwae0pjaaokeo3n3mg335.jpg "/>

This article is from the "Cbo#boy_linux Road" blog, make sure to keep this source http://20151213start.blog.51cto.com/9472657/1879551

Nginx proxy Settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.