Using Nginx to build a reverse proxy server under Windows

Source: Internet
Author: User
Tags nginx reverse proxy

The reverse proxy method refers to a proxy server that accepts connection requests on the Internet, then forwards the request to a server on the internal network and returns the results from the server to the client requesting the connection on the Internet, Reverse. At this point the proxy server appears as a reverse proxy server externally.

This article is intended to build an Nginx reverse proxy server.

1, Nginx installation configuration can refer to the blog: http://www.cnblogs.com/wangwust/p/6420503.html

2, modify the Nginx configuration file, as follows:

server {        Listen       8888;        server_name  localhost;

Modified to:

 server {listen  80  ; server_name  192.168 .    1.20 ; //               reverse proxy server IP  location/ {Proxy_pass     http:  // 192.168.1.10;                  // web server IP                  Proxy_redirect off;                Proxy_set_header X -real-ip $remote _addr; Proxy_set_header X -forwarded-for $proxy _add_x_forwarded_for;}  

3, verification. Visit 192.168.1.20 in the browser to see if the 192.168.1.10 is processing the request.

4. Reference configuration:

#user nobody;worker_processes4; #error_log logs/Error.log, #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid;events {worker_connections1024x768;}    HTTP {include mime.types; Default_type Application/octet-stream; #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_timeout0; Keepalive_timeout $;    #gzip on; server { Listen 8081;        server_name www.test.com; #charset Koi8-R; #access_log logs/Host.access.log Main; Location/{root D:/work/temp/nginxtest;        Index index.html index.htm; }   location^~/kuaixun/{proxy_pass http://localhost/kuaixun/;             Proxy_redirect off;              Proxy_set_header Host $host: $server _port;              Proxy_set_header X-real-ip $remote _addr; Proxy_set_header x-forwarded-For  $proxy _add_x_forwarded_for; } #error_page404/404. html; # REDIRECT Server error pages to theStaticPage/50x.html # Error_page - 502 503 504/50x.html; Location= /50x.html {root html; } # Proxy The PHP scripts to Apache listening on127.0.0.1: the# #location~\.php$ {# Proxy_pass http://127.0.0.1;#} # Pass the PHP scripts to FastCGI server listening on127.0.0.1:9000# #location~\.php$ {# root HTML; # Fastcgi_pass127.0.0.1:9000;        # Fastcgi_index index.php; # Fastcgi_param Script_filename/Scripts$fastcgi_script_name;        # include Fastcgi_params; #} # Deny access to. htaccess files,ifApache's Document Root# concurs with Nginx'S One# #location~ /\.ht {# deny all; #}} # anotherVirtualHostusingMix of ip-, name-, and port-based configuration # #server {# listen8000; # Listen Somename:8080;    # server_name somename alias Another.alias; # Location/{# root HTML;    # index index.html index.htm; #} #} # HTTPS Server # #server {# listen443SSL;    # server_name localhost;    # ssl_certificate Cert.pem;    # Ssl_certificate_key Cert.key;    # Ssl_session_cache shared:ssl:1m;    # ssl_session_timeout 5m; # Ssl_ciphers High:!anull:!MD5;    # ssl_prefer_server_ciphers on; # Location/{# root HTML;    # index index.html index.htm; #    }    #}}

This article refers to:http://blog.csdn.net/abc19900828/article/details/39478125.

Using Nginx to build a reverse proxy server under Windows

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.