Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the local picture server by Nginx

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how Nginx configures its local image server. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Introduction of Nginx

Nginx is the reverse proxy server.

First of all, let's take a look at what is a proxy server. A proxy server generally refers to a server in the local area network that sends requests to the Internet through proxy services, and the proxy server generally acts on the client. Like the GoAgent,FQ artifact.

A complete proxy request process is as follows: the client first creates a connection with the proxy server, and then requests to create a connection to the target server or obtain the specified resources of the target server according to the proxy protocol used by the proxy server. The Web proxy server is the intermediate entity of the network. The agent is located between the Web client and the Web server and acts as a "middleman".

The proxy server for HTTP is both a Web server and a Web client.

The proxy server is another server between the client and the Web server. with it, the browser does not go directly to the Web server to retrieve the web page, but by sending a request to the proxy server, the signal will be sent to the proxy server first, and the proxy server will retrieve the information needed by the browser and send it to your browser.

A forward proxy is a server located between the client and the original server. in order to get the content from the original server, the client sends a request to the agent and specifies the target (the original server). Then the agent transfers the request to the original server and returns the obtained content to the client, the client must make some special settings to use the forward proxy.

Reverse proxy server: receive the request from the client on the server side, then distribute the request to the specific server for processing, and then feedback the response result of the server to the client. Nginx is one of the reverse proxy server software.

Nginx:Nginx ("engine x"), Nginx is a high performance HTTP and reverse proxy server written by Russian Igor Sysoev (Sesoyev). It is also an IMAP/POP3/SMTP proxy server, that is, Nginx itself can host a Web site for HTTP service processing, or it can be used as a reverse proxy server.

The forward proxy client must set up the forward proxy server, of course, as long as you know the IP address of the forward proxy server and the port of the agent.

The reverse proxy is just the opposite of the forward proxy, the proxy server is like the original server to the client, and the client does not need to make any special settings. The client sends a normal request to the content in the namespace of the reverse proxy, which then determines which original server to transfer the request to and returns the obtained content to the client.

Second, set up the picture server

After installing nginx locally, we can access it through the port. The default port is port 80. On my side, due to the conflict with local port 80, I modified it to 8089.

At this point, we successfully start nginx, and then under the nginx directory, add the image path we need to configure as follows:

# add the code for the picture location ~. *\. (gif | jpg | jpeg | png) ${expires 24h; root Hazard Greater Radalabash # specify the path to store the picture, access_log Hpurt Greater Radalog, # the image path proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path H:/radar/ # Image path proxy_redirect off; proxy_set_header Host 127.0.0.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900 Proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if (!-e $request_filename) {proxy_pass http://127.0.0.1:8089; # proxy access address}}

According to the above configuration, find the path we need. Then after restarting the service, you can see the picture we configured. As shown in the following figure

At this point, a simple nginx image server is set up.

Thank you for reading! This is the end of the article on "how to configure the local picture server in Nginx". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report