Home > Operation and Maintenance > Nginx > How to use ChatGPT to solve the problem of Nginx reverse proxy

How to use ChatGPT to solve the problem of Nginx reverse proxy

王林
Release: 2023-05-26 16:19:45
forward
2102 people have browsed it

Background

I have 3 servers, 1 Web server provides external access, and the other two servers QC1 and QC2 are used to store photos saved after recognition by different devices. Their IP addresses are as follows:

##QC1192.168.100.1QC2192.168.100.2
Server name IP address
Web server 10.76.2.10
The front-end program needs to display the picture according to its file name. The first thing that came to mind was to use Nginx to perform a reverse proxy to solve this problem.

For example, if the photo file name starts with QC1, then the photo is fetched from the 192.168.100.1 server, and the user accesses

http://10.76.2.10:8029/media/QC1_20220318T131856_1_CT.jpg, the actual access is http://192.168.100.1/media/QC1_20220318T131856_1_CT.jpg.

However, since I am not very familiar with Nginx configuration and ChatGPT has become very popular recently, I came up with the idea of ​​asking ChatGPT to solve this problem, which led to the following conversation between me and ChatGPT.

Use ChatGPT to solve

I asked ChatGPT about the Nginx reverse proxy issue and briefly introduced my background. ChatGPT rapidly comprehended my issue and furnished me with the subsequent Nginx configuration.

How to use ChatGPT to solve the problem of Nginx reverse proxy

If the accessed address changes, it will modify the configuration again.

How to use ChatGPT to solve the problem of Nginx reverse proxy

How to use ChatGPT to solve the problem of Nginx reverse proxy#I don’t know what the if statement written for it is used for, and it can also give a corresponding explanation.

How to use ChatGPT to solve the problem of Nginx reverse proxy

At this time I probably understood that as long as we get the $1 variable, we can reverse the proxy server request based on the file name of the photo. However, the upstream configuration it provided before did not have the addresses corresponding to QC1 and QC2, so we continued to let ChatGPT modify it.

How to use ChatGPT to solve the problem of Nginx reverse proxy

How to use ChatGPT to solve the problem of Nginx reverse proxy

##After adjustments are made, let ChatGPT regenerate a complete nginx configuration.

How to use ChatGPT to solve the problem of Nginx reverse proxy

How to use ChatGPT to solve the problem of Nginx reverse proxy

Okay, we copied this configuration to the server, modified it slightly, restarted Nginx, and used Browse device test. How to use ChatGPT to solve the problem of Nginx reverse proxy

The above is the detailed content of How to use ChatGPT to solve the problem of Nginx reverse proxy. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template