How to configure reverse proxy and Nginx reverse proxy for nginx

Source: Internet
Author: User
Tags nginx reverse proxy

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.