How to do reverse proxy in nginx
How does nginx do a reverse proxy?
The network structure is as shown above.
Maybe you only have one public IP address. But you have a website on your intranet If you need to map to the external network and do not want to add other non-80 ports, you can directly use nginx as a reverse proxy.
First, configure the nginx.conf file.
http { include mime.types; default_type application/octet-stream; client_max_body_size 8m; ################################################################################ include /usr/local/u-mail/config/nginx/reverse-proxy.conf; ################################################################################ #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upload_progress proxied 1m; ############################################################################### gzip on; #client_max_body_size 50m; client_body_buffer_size 256k; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; proxy_connect_timeout 300s; proxy_read_timeout 300s; proxy_buffer_size 64k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; proxy_ignore_client_abort on; ############################################################################### include vhost/*.conf; }
The above configuration file refers to the /usr/local/u-mail/config/nginx/reverse-proxy.conf;
configuration file. You can use relative paths for this filling, or The absolute path can be filled in. For the sake of demonstration, the absolute path will be filled in directly.
Then look at the referenced configuration file information.
As above. Then restart the nginx service directly. Check whether it is normal and whether there is any error. If there is no error message, it is OK. If you have multiple websites, you can set multiple server sections in reverse-proxy.conf. .One website and one section. Separate them. It will be convenient to check next time.
For more Nginx related knowledge, please visit the Nginx Usage Tutorial column!
The above is the detailed content of How to do reverse proxy in nginx. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HTTP request sniffing defense method in Nginx reverse proxy

Nginx reverse proxy Websocket configuration tutorial to achieve real-time communication

Nginx reverse proxy server connection limit and request queue tuning method

Secure DNS resolution in Nginx reverse proxy

Nginx reverse proxy HTTPS configuration, encrypted website transmission

Nginx reverse proxy WebSocket configuration to achieve real-time communication

Multi-port access control policy in Nginx reverse proxy

Security performance monitoring and analysis in Nginx reverse proxy
