Nginx (LNMP) reverse proxy configuration tutorial Zhaorong Tribe

Nginx (LNMP) Reverse Proxy Configuration Tutorial

Time: August 15, 2011 Column: VPS Tutorial Author: Zhao Rong Click: 21459 times

 Proprietary computer room/advanced anti DDoS server/advanced anti DDoS VPS/American advanced anti DDoS/Los Angeles VPS/Los Angeles advanced anti DDoS server

When it comes to how to configure Nginx Reverse proxy First, let's understand what is reverse proxy. Reverse proxy is a proxy server that accepts Internet connection requests, and then forwards the requests to another server.

Originally, I could not use the reverse proxy for a long time, so I never did. It happened that a space on EWSIDC a few days ago was not allowed to be bound because of the problem of the domain name (imzhaorong. com) BA, and could only be accessed through the three-level domain name provided by the system. But I still want to use the original top-level domain name to access the content of this space. What should I do? Use the VPS in hand to do reverse proxy. Next, let's look at the detailed process.

First, let's talk about the general environment. The non BA top-level domain name I use is imzhaorong.com, the EWSIDC level 3 domain name is 1e01f.wi.ipc.la, and the VPS I use is the $1 cloud VPS of Host1Plus, and LNMP has been installed.

First, we need to record the domain name imzhaorong.com resolution A to the VPS IP address;

Then, modify nginx Configuration file. In this tutorial, we will download the nginx. conf of VPS to local modification (the file directory is located in/usr/local/nginx/conf/). Let me start with the last screenshot:

 nginx

The blue part in the figure is the code we added. The reason why we need to add a picture is to pay attention to the location of the code. Zhao Rong had made a mistake before. Fortunately, the fourth senior brother mentioned something. Now, I will paste the code:

server    {
        listen          80;
        server_name     imzhaorong.com;

        location / {
            proxy_pass              http://1e01f.wi.ipc.la/ ;
            proxy_redirect          off;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            }
    }

After the modification, we first execute:/usr/local/nginx/sbin/nginx - t to check whether the configuration is normal. If the configuration file/usr/local/nginx/conf/nginx. conf syntax is ok configuration file/usr/local/nginx/conf/nginx. conf test is successful, it is normal. Otherwise, if the configuration is modified according to the error prompt, the error prompt will be accurate to which line.

Finally, execute kill HUP ` cat/usr/local/nginx/logs/nginx. pid ` to make the configuration take effect. If your domain name resolution also takes effect, you should be able to access it directly through the top-level domain name.

There are many uses of reverse proxy. Let's explore them by ourselves.

 Advanced Defense VPS/Los Angeles Advanced Defense/Advanced Defense Server/20 year old computer room

Statement: Blogs are only for sharing information and are not recommendations. Websites do not participate in transactions and are not intermediaries. The content only represents personal views and is not authoritative. Readers should consider it and take their own risks! Every penny and every commodity is still the eternal truth. Juvenile readers (including physical and psychological) should visit this website with their guardians! This article is written by( Zhao Rong )Original compilation, reprint, please keep the link: Nginx (LNMP) Reverse Proxy Configuration Tutorial The code is not easy, please do not copy or paste!
About using: This website mainly shares server and VPS information, and does not provide any product sales or purchase. All visitors please purchase and use products within the scope of national laws and regulations. QQ group discussion: 683851361
About safety: Any IDC has the possibility of going bankrupt and running away. The host line is even more uncontrollable. Monthly payment and backup are your best choices. Please keep good and regular backup habits

Nginx (LNMP) reverse proxy configuration tutorial: currently there are 9 messages

  1. 7th floor
    wheat :

    With this reverse proxy, will the domain name in the address bar become a third level domain name after accessing the website content?
    What's the difference between this and our vps building a website and then jumping?

    2013-11-21 11:54 [Reply]
  2. 6th floor
    zbyzwy :

    Is the sister's anti generation influence included

    2013-02-25 09:36 [Reply]
    • Zhao Rong :

      I think it may be, but I haven't paid attention to whether it is willing to be included or how long it will be included.

      2013-02-25 10:29 [Reply]
  3. Hello, is there any way to reverse proxy two domain names?
    For example, I need to reverse proxy youtube
    But youtube pictures and videos are placed in another domain name and space
    I can open youtube now, but because there is no reverse direction, other domains cannot see pictures and videos
    Is there any way to do this? Thank you

    2012-08-29 19:38 [Reply]
    • Zhao Rong :

      I don't do much research on reverse proxy, but you should be able to solve this problem

      2012-08-29 20:27 [Reply]
  4. 4th floor
    Xiaodong :

    It's a pity that the link is still the original domain name.

    2012-07-30 20:22 [Reply]
  5. floor
    gdmonth :

    Very good content. Ha ha

    2011-08-15 19:29 [Reply]
  6. Bench
    I am :

    I feel very tired after struggling with VPS 💡

    2011-08-15 16:25 [Reply]
  7. Literacy==what Rongge said, BA=filing.

    2011-08-15 14:37 [Reply]

Comment


 hostyun  locvps

Advertise