(summary) The simplest Nginx reverse proxy configuration on a Linux server

Source: Internet
Author: User
Tags nginx reverse proxy

Nginx is not only a high-performance Web server, but also a high-performance reverse proxy server. The following is a brief talk about Nginx reverse proxy function.

What is a reverse proxy?

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

Simple Implementation Method:

For example, I want to build a google.ha97.com domain name on the server to reverse proxy access to Google, first in the Domain name Registrar domain name management for the domain name google.ha97.com add a record to the server IP, and then modify the Nginx configuration file on the server, add the following:

Server
{
Listen 80;
server_name google.ha97.com;

Location/{
Proxy_pass http://www.google.com/;
Proxy_redirect off;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
}
}

Reload Nginx after saving:

/etc/init.d/nginx Reload

If it is compiled and installed, apply this command:

Kill-hup ' Cat/usr/local/nginx/logs/nginx.pid '

After the domain name resolution is effective, you can visit Google via google.ha97.com. This method can be disguised as Fanqiang. This is the simplest application of nginx reverse proxy. On the use of Nginx reverse proxy load Balancing method, the next time to write again.

(summary) The simplest Nginx reverse proxy configuration on a Linux server

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.