nginx配置



nginx.conf配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#user  nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}

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_timeout 0;
keepalive_timeout 65;

#gzip on;



# another virtual host using mix of IP-, name-, and port-based configuration

server {
# 修改nginx默认端口
listen 81;
server_name localhost;

location / {
root html;
index index.html index.htm;
}
}
include vhosts/*.conf;

# 将9001端口号请求转发到 匹配到的正则表达式 下
# ~ :使用正则匹配,不然就是完全匹配。
server {
listen 9001;
server_name localhost;

location ~ /eduservice/ {
proxy_pass http://localhost:8002;
}
location ~ /eduoss/ {
proxy_pass http://localhost:8003;
}
location ~ /eduvod/ {
proxy_pass http://localhost:8004;
}
location ~ /cmsservice/ {
proxy_pass http://localhost:8005;
}
location ~ /ucenterservice/ {
proxy_pass http://localhost:8006;
}
location ~ /edumsm/ {
proxy_pass http://localhost:8007;
}
location ~ /orderservice/ {
proxy_pass http://localhost:8008;
}
location ~ /staservice/ {
proxy_pass http://localhost:8009;
}
}

client_max_body_size 50m;
}

打赏
  • 版权声明: 本博客所有文章除特别声明外,均采用 Apache License 2.0 许可协议。转载请注明出处!
  1. © 2020 Liu Yang    湘ICP备20003709号

请我喝杯咖啡吧~

支付宝
微信