How to configure reverse proxy and Nginx reverse proxy for nginx
The network structure is as follows.
You may only have one public IP address. however, your intranet has a website that needs to be mapped to the Internet. and do not want to add other non-80 ports. then you can directly use nginx for 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 has reference/usr/local/u-mail/config/nginx/reverse-proxy.conf;
Configuration file. You can use the relative path or absolute path to fill in the configuration file. In this example, enter the absolute path directly.
Then let's take a look at the referenced configuration file information.
As shown above. then restart the nginx service. check whether it is normal. is there any error. if there is no error message, OK. if you have multiple websites, you can set the server segments in multiple reverse-proxy.conf. one website and one segment. separated. it is very convenient to view it next time.