复制代码
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
62user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/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 /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; # 注意,这里的server名字即fgateway.mytest.com不能带下划线,有下划线则不能访问 upstream fgateway.mytest.com { server 192.168.1.68:30001 weight=1; server 192.168.1.69:30001 weight=1; } server { listen 80; server_name mytest.com; location / { #root /home/project/pa; #index index.html; proxy_pass http://192.168.1.70; } } server { listen 80; server_name gateway.mytest.com; location / { #root /home/project/pa; #index index.html; proxy_pass http://fgateway.mytest.com; #proxy_pass http://192.168.1.69:30001; proxy_connect_timeout 1; #单位为秒 proxy_send_timeout 1; proxy_read_timeout 1; } } }
最后
以上就是大方大炮最近收集整理的关于nginx的简单配置的全部内容,更多相关nginx内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复