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

The method of Windows installing nginx1.10.1 reverse Agent to visit IIS website

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Most people do not understand the knowledge points of this article "Windows installs nginx1.10.1 reverse agent to visit IIS website", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Windows installation nginx1.10.1 reverse agent access IIS website method" article.

First of all, go to the official website to download the software package and decompress it. The path should not be in Chinese.

Path problems in nginx configuration

Because the file path can be "\" or "\" under windows, or "/" can be used as the path delimiter. But "\" is the most likely to cause problems, so try to avoid using it.

Do not add path, otherwise an error will be raised and the path of the config file cannot be found

For example, I decompress the e disk.

The cmd command navigates to the folder where nginx.exe is located, cd e:\ worksoftware\ nginx-1.10.1

Then execute, first of all, make sure that there is no problem with the nginx.conf file configuration.

In fact, the most important and main work of nginx is the configuration file, and there is nothing else that we application developers need to pay attention to unless we want to modify the underlying source code.

The nginx.conf configuration is as follows:

# user nobody; worker_processes 1; # number of worker processes, you can configure multiple # global error logs and pid files error_log / worksoftware/nginx-1.10.1/logs/error.log; # error_log logs/error.log notice; # error_log logs/error.log info; pid / worksoftware/nginx-1.10.1/logs/nginx.pid; events {worker_connections 1024 # maximum number of connections per process (maximum number of connections = number of connections * number of processes)} # set http server, use its reverse proxy function to provide load balancing support http {include mime.types; # set configuration file location, where conf refers to the directory where nginx.conf is located, and you can also specify the configuration file default_type application/octet-stream of other places with absolute path # default type-octal file stream # set log format # log_format main'$remote_addr-$remote_user [$time_local] "$request'#'$status $body_bytes_sent" $http_referer "'#'" $http_user_agent "" $http_x_forwarded_for "; # set access log # access_log / worksoftware/nginx-1.10.1/logs/access.log main; sendfile on # whether to activate the sendfile () function is more efficient than the default mode # tcp_nopush on; # compress the http response header into a packet and send it only when sendfile is enabled # connection timeout # keepalive_timeout 0; keepalive_timeout 65; gzip on # enable gzip compression # Cluster of servers # set the server list of load balancer to support multiple groups of load balancers, and you can configure multiple upstream to serve different server. # nginx's upstream supports several ways of allocation # 1) polling (default) each request is allocated to a different backend server one by one in chronological order, which can be automatically eliminated if the backend server down is dropped. # 2), weight specifies the polling probability, and weight is proportional to the access ratio, which is used in the case of uneven performance of back-end servers. As above, the weight is assigned. # 3) and ip_hash each request is allocated according to the hash result of accessing the ip, so that each visitor accesses a back-end server regularly, which can solve the session problem. # 4), fair # 5), url_hash # urlhash # upstream imicrosoft.net # {# Server Cluster name # Server configuration weight means weight. The greater the weight, the greater the probability of allocation. # server 192.98.12.60 weight=3 max_fails=2 fail_timeout=30s; # server 192.98.12.42 weight=3 max_fails=2 fail_timeout=30s; # weigth parameters represent weights. The higher the weight, the greater the probability of being assigned. # 1.down indicates that the server before the order is temporarily not participating in the load # 2.weight defaults to 1.weight, the greater the weight of the load. # 3.backup: all other non-backup machines down or request backup machines when they are busy. So this machine will be the least stressed. # this example means that on the same server, multiple servers can change the ip # server 127.0.0.1 ip 8055 weight=4 down; # server 127.0.0.1 weight=4 down; 8010 weight=5 backup; #} upstream localhost {server 127.0.1 weight=4 down; 9000 weight=3 max_fails=2 fail_timeout=200s; server 127.0.0.1 weight=4 down; 8086 weight=5 max_fails=2 fail_timeout=200s } # current nginx configuration, proxy server address, that is, server address, listening port, default address of nginx installation, # setting virtual host, default listening port 80 server {listen 9090; # listening port 9090 # for server_name, if you need to reverse proxy requests for multiple domain names, you can configure multiple server_name to meet the requirements of server_name localhost. # the domain name of the current service charset utf8; # charset koi8-r; # sets the access log of this virtual host # access_log logs/host.access.log main; # if you access / images/*, / js/*, / css/* resources, the local files are directly fetched without forwarding. # but if there are more files, the effect is not too good. # location ~. *\. (jpg | jpeg | gif | css | png | ico | html) $# {# expires 30d; # root / nginx-1.10.1;#root: # break; #} # enable load balancing location / {root html; # the default home directory is index index.html index.htm index.aspx in the nginx installation directory # if there is no index page, list files and subdirectories # proxy_pass http://www.imicrosoft.net; # corresponds to the autoindex on; of the upstream containing the balance server # when there is no index page, list files and subdirectories # retain the true user information proxy_redirect off; # url does not jump to proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr Proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; # buffer proxy buffers the maximum number of bytes requested by the client, which can be understood as saving it locally and then passing it to the user # client_body_buffer_size 128k; # # initiate a handshake with the backend server connection timeout to wait for a response timeout # proxy_connect_timeout 12 # # waiting for the response time of the backend server after a successful connection has actually entered the backend queue for processing # proxy_read_timeout 90; # # the proxy request cache will store the user's header information and a total of nginx for rule processing. Generally, as long as the following header information can be saved # proxy_send_timeout 90 # # same as above, tell nginx the maximum space for storing several buffer for a single use: # proxy_buffer_size 4k; # proxy_buffers 432k; # # if the system is very busy, you can apply for the domestic proxy_buffers official recommendation * 2 # proxy_busy_buffers_size 64k; # # proxy cache temporary file size proxy_temp_file_write_size 64k # proxy_next_upstream error timeout invalid_header http_500 http_503 http_404; proxy_max_temp_file_size 128m; # launch agent proxy_pass http://localhost; client_max_body_size 10m; # maximum number of bytes of a single file allowed to be requested by the client} # example # location / {# proxy_pass http://imicrosoft.net; # # proxy_redirect default # # proxy_set_header host $host; # proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; #} # example II # location / tileservice {# proxy_pass http://cluster/mongotileservice/tileservice; # proxy_set_header host $host; # proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; #} # error_page 404 / 404.html # redirect server error pages to the static page / 50x.html # error_page 500502 503504 / 50x.htl; location = / 50x.html {root html;} # proxy the php scripts to apache listening on 127.0.0.1 proxy_pass 80 # enable load balancing for "/ xxxxx.php" # location ~\. Php$ {# proxy_pass #} # location / baidu # {# proxy_pass http://www.google.com; # proxy_set_header host $host; # proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; #} # pass the php scripts to fastcgi server listening on 127.0.0.1 proxy_pass 9000 # # location ~. Php$ {# root html; # fastcgi_pass 127.0.0.1 proxy_pass 9000 # fastcgi_index index.php; # fastcgi_param script_filename / scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if apache's document root # concurs with nginx's one # # location ~ /\ .ht {# deny all; #} # another virtual host using mix of ip-, name-, and port-based configuration # # server {# listen 8000; # listen somename:8080 # server_name somename alias another.alias; # location / {# root html; # index index.html index.htm; #} #} # https server # # server {# listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:ssl:1m; # ssl_session_timeout 5m # ssl_prefer_server_ciphers on; # location / {# root html; # index index.html index.htm; #} #}}

The result is shown in the figure:

Iis site

The above is about the content of this article about "Windows installs nginx1.10.1 reverse agent to visit IIS website". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.

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

Internet Technology

Wechat

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

12
Report