A method of configuring Nginx reverse proxy on Linux VPS

Source: Internet
Author: User
Tags vps net domain nginx reverse proxy

What is the reverse proxy?

A reverse proxy is a proxy server that accepts a connection request on the Internet and then forwards the request to a server on the internal (or other) network and returns the results obtained from the server to the client on the Internet requesting a connection.

Implementation method:

For example, I would like to build a VPS t.jb51.net domain name used to reverse proxy access to Twitter, first in the domain name registrar where the domain name t.vpser.net add a record to the IP VPS, and then modify the VPS Nginx profile, add the following:

The code is as follows:

Server

{

Listen 80;

server_name t.jb51.net;

Location/{

Proxy_pass http://twitter.com/;

Proxy_redirect off;

Proxy_set_header X-real-ip $remote _addr;

Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;

}

}

After adding good, first executes:/USR/LOCAL/NGINX/SBIN/NGINX-T check the configuration is normal, if display: the Configuration file/usr/local/nginx/conf/nginx.conf syntax Is OK configuration file/usr/local/nginx/conf/nginx.conf the test is successful normal, otherwise you will be prompted to modify the configuration by error.

Then perform kill-hup ' cat/usr/local/nginx/logs/nginx.pid ' so that the configuration takes effect, and after that, the domain name resolution can be accessed via t.vpser.net.

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.