nginx中简单使用转发和轮询

nginx中简单使用转发和轮询(linux,windows几乎差不多的配置)

1:先看测试效果截图

1.1 nginx轮询

nginx中简单使用转发和轮询

1.2:nginx 代理转发

nginx中简单使用转发和轮询

2:主要配置代码截图

nginx中简单使用转发和轮询

 

nginx中简单使用转发和轮询

 

3:nginx相关主要的code

 1 #user  nobody;
 2 worker_processes  1;
 3 
 4 #error_log  logs/error.log;
 5 #error_log  logs/error.log  notice;
 6 #error_log  logs/error.log  info;
 7 
 8 #pid        logs/nginx.pid;
 9 
10 
11 events {
12     worker_connections  1024;
13 }
14 
15 
16 http {
17     include       mime.types;
18     default_type  application/octet-stream;
19 
20     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
21     #                  '$status $body_bytes_sent "$http_referer" '
22     #                  '"$http_user_agent" "$http_x_forwarded_for"';
23 
24     #access_log  logs/access.log  main;
25 
26     sendfile        on;
27     #tcp_nopush     on;
28 
29     #keepalive_timeout  0;
30     keepalive_timeout  65;
31 
32     #gzip  on;
33     upstream jasonweb {
34         server localhost:8885;
35         server localhost:8886; # weight=2; ШЈжи
36         server localhost:8887;
37     }
38 
39     server {
40         listen       8080;
41         server_name  localhost:8080;
42 
43         #charset koi8-r;
44 
45         #access_log  logs/host.access.log  main;
46 
47         location / {
48             
49             proxy_pass http://jasonweb;
50             root   html;
51             index  index.html index.htm;
52         }
53         error_page   500 502 503 504  /50x.html;
54         location = /50x.html {
55             root   html;
56         }
57 
58     }
59  server {
60     listen 8888;
61     server_name somaename alias another.alias;
62     location / {
63         root D:\\_nginx\\test_demo;
64         index  index.html index.htm;
65 
66             try_files $uri $uri/ /index.html;
67     }
68     location ^~/qq1/ {
69         proxy_pass http://localhost:8885/;
70     }
71     location ^~/qq2/ {
72         proxy_pass http://localhost:8886/;
73     }
74     location ^~/qq3/ {
75         proxy_pass http://localhost:8887/;
76     }
77 }
78 
79 }

 

上一篇:activiti实战系列 排他网关(ExclusiveGateWay)


下一篇:Linux病毒扫描工具ClamAV(Clam AntiVirus)