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.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.