普拉多VX

人生一路,不问来时,不知归期

0%

需求说明

根据数据库中的创建时间来根据小时、天统计平均在线的设备数量

实现

在视图中方法中导入connection模块

views.py

1
2
from django.db import connection
from django.db.models import Sum,Count,Avg

参考用法
具体使用的方法为,其他方法用法可参考源码文件

  • date_trunc_sql
  • datetime_trunc_sql
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
class PoolWorkersCharView(generics.GenericAPIView):
"""
获取矿池在线矿机数据,可根据计划任务进行调整和统计
"""
pagination_class = (IsAuthenticated,)

def get(self, request):
dimension = request.GET.get('dimension','1h')
num_size = request.GET.get("size", 24)

if dimension == '1h':
# 根据小时获取平均在线矿工数
select = {'hour': connection.ops.datetime_trunc_sql('hour', 'created_at',settings.TIME_ZONE)}
workers_data = StatsPoolMinerWorkers.objects.filter(coin='eth').extra(select=select).values(
'hour').annotate(sum=Avg('workers'))
ser_worker_dict = PoolWorkersHourSerializer(workers_data, many=True)
else:
# 根据天获取平均在线矿机数
select = {'day': connection.ops.date_trunc_sql('day', 'created_at')}
workers_data = StatsPoolMinerWorkers.objects.filter(coin='eth').extra(select=select).values(
'day').annotate(sum=Avg('workers'))

ser_worker_dict = PoolWorkersDaySerializer(workers_data, many=True)

return_data = ser_worker_dict.data[:num_size]
return Response({'workers':return_data,'count':len(return_data)})

参考

修改mysql列字段名称

语法:

1
ALTER TABLE 表名 CHANGE 字段名 新字段名 字段属性

实例:

  • server_sslcert_items 表
  • url_status 原字段
  • status 新字段
1
alter table server_sslcert_items change url_status status int;

根据不同参数调用不同

自定义get_serializer_class方法

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

class QueryItemsView(ListAPIView):
authentication_classes = (JSONWebTokenAuthentication, SessionAuthentication)
permission_classes = (IsAuthenticated,)


def get_serializer_class(self):
if self.post_type == 'port':
return serializers.ServerPortItemsSerializer
elif self.post_type == 'web':
return serializers.WebItemsSerializer
elif self.post_type == 'ssl':
return serializers.SslCertSerializer
else:
return serializers.WebItemsSerializer

def get_queryset(self):

self.post_type = self.request.GET.get('item_type', 'port')

if self.post_type == "port":
queryset = ServerPortItems.objects.filter(uid=self.request.user.id).order_by('-create_at')
elif self.post_type == 'web':
queryset = ServerWebItems.objects.filter(uid=self.request.user.id).order_by('-create_at')
elif self.post_type == 'ssl':
queryset = ServerSslcertItems.objects.filter(uid=self.request.user.id).order_by('-create_at')
else:
queryset = ServerPortItems.objects.filter(uid=self.request.user.id).order_by('-create_at')

return queryset

当然也可以根据不同的逻辑实现调用不同的放,比如请求类型GET/POST

1
2
3
4
5
6
def get_serializer_class(self):
"""重写获取序列化器类的方法"""
if self.request.method == "GET":
return Model2Serializer
else:
return ModelSerializer

说明

使用apt-get 默认仓库安装的版本是1.10,要不就添加仓库安装,要不就下载源码安装。我采用源码安装。

安装

1
2
3
4
5
6
7
8
9
10
11
root@monitor:~# wget -c https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local #下载并解压到/usr/local/目录下
--2020-12-02 10:38:36-- https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz
Resolving dl.google.com (dl.google.com)... 203.208.43.65
Connecting to dl.google.com (dl.google.com)|203.208.43.65|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 123658438 (118M) [application/octet-stream]
Saving to: ‘STDOUT’

- 100%[==================================================================================>] 117.93M 11.4MB/s in 9.3s

2020-12-02 10:38:46 (12.6 MB/s) - written to stdout [123658438/123658438]

添加环境PATH

PATH
1
2
3
4
5

```bash
root@monitor:~#
root@monitor:~# vim /etc/profile
root@monitor:~# source /etc/profile

检查golang版本

1
2
3
root@monitor:~# go version
go version go1.14.2 linux/amd64
root@monitor:~#

编写测试程序

test.go

1
2
3
4
5
6
7
8

package main

import "fmt"

func main() {
fmt.Println("hello world")
}

编译并执行

1
2
3
root@monitor:~# go build test.go 
root@monitor:~# ./test
hello world

设置mysql字符集 for Ubuntu 18.04

设置方法

修改 /etc/mysql/mysql.conf.d/mysqld.cnf

添加:character-set-server=utf8

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
character-set-server=utf8 //添加
skip-external-locking

修改 /etc/mysql/conf.d/mysql.cnf

添加:default-character-set=utf8

1
2
3
[mysql]
default-character-set=utf8
~

重启

1
systemctl  restart mysql.service

检查发现以下字符集已经修改成功

Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8

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
root@localhost:# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.32-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \s
--------------
mysql Ver 14.14 Distrib 5.7.32, for Linux (x86_64) using EditLine wrapper

Connection id: 2
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.32-0ubuntu0.18.04.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 21 sec

Threads: 1 Questions: 5 Slow queries: 0 Opens: 105 Flush tables: 1 Open tables: 98 Queries per second avg: 0.238
--------------

mysql>

主窗体

使用MainWindow结构体定义主窗体

样例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

MainWindow{
Title: "GUI程序",
MinSize: Size{600, 400},
Layout: VBox{},
Children: []Widget{
HSplitter{
Children: []Widget{
TextEdit{AssignTo: &inTE},
TextEdit{AssignTo: &outTE, ReadOnly: true},
},
},
PushButton{
Text: "转换",
OnClicked: func() {
outTE.SetText(strings.ToUpper(inTE.Text()))
},
},
},
}.Run()

常用属性

以下我列出目前阶段我常用的属性设置,后面待补充,或者自己参考源码。

  • Title: 程序头部标题
  • MinSize: 定义最小窗体(默认窗体可以拖动)如设置即:默认窗体可缩小的最小比例 分别为宽度,高度像素
  • MaxSize: 定义最大窗体(默认窗体可以拖动)如设置即:默认窗体可缩大的最大比例 分别为宽度,高度像素
  • Layout: 全局布局类型
  • Children: 控件集
  • MenuItems: 程序菜单栏
  • TooBar: 工具栏
  • Font: 窗体文字样式,使用Font:Font{} 结构体方式声明。
  • Icon: 设置Icon图标路径 使用Icon: “img/xx.ico”

参考-字体样例

1
2
3
4
5
font := Font{
Family: "Times New Roman", //字体
PointSize: 10, //大小
Bold: true, //是否加粗
}

参考-菜单定义

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 定义菜单
MenuItems: []MenuItem{

Menu{
Text: "&关于",
Items: []MenuItem{
Action{
Text: "版本",
OnTriggered: func() {
walk.MsgBox(mw, "版本", versionStr, walk.MsgBoxIconInformation)
},
},
//...
},
},
},

布局

主窗体布局可以使用两种布局方式,分别为VBox和HBox。具体的布局根据自己程序的设计自己选择。

  • VBox(垂直布局)
  • HBox(水平布局)

菜单栏

菜单定义使用Menu属性

  • Text: 文字定义
  • OnTriggered: 点击事件
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
// 定义菜单
MenuItems: []MenuItem{
Menu{
Text: "&系统",
Items: []MenuItem{
Action{
Text: "退出",
OnTriggered: func() { mw.Close() },
},
},
},

Menu{
Text: "&关于",
Items: []MenuItem{
Action{
Text: "版本",
OnTriggered: func() {
walk.MsgBox(mw, "版本", versionStr, walk.MsgBoxIconInformation) //弹出消息框,类型为info
},
},
Action{
Text: "联系我们",
OnTriggered: func() {
walk.MsgBox(mw, "联系我们", "开发者:蓝谷骑兵\nQQ:923401910", walk.MsgBoxIconInformation)
},
},
},
},
},

工具栏

ToolBar声明,源码中定义了4中ToolBar样式,分别为以下几种

  • ToolBarButtonImageOnly //单一图片样式
  • ToolBarButtonTextOnly //单一文字样式
  • ToolBarButtonImageBeforeText //图片在文字之前
  • ToolBarButtonImageAboveText //图片在文字之上
1
2
3
4
5
6
7
8
9
10
11
12
13
TooBar: TooBar{
ButtonStyle: 样式,
Items:[]MenuItem{
ActionRef{Action},
Menu{
//工具栏一
},
Separator{}, // 分割线
Menu{
//工具栏二
},
}
}

参考样图

源码样例

提示没有gcc问题

windows 10

1
2
3
C:\Users\UI\go\src\ThorGui>go get
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%

解决方法

1.下载gcc并安装 https://jmeubank.github.io/tdm-gcc/

注意勾选,默认即可

完成安装

2.验证是否安装成功

gcc -v

1
2
3
4
5
6
7
8
9
10
C:\Users\UI>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/9.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-git-9.2.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --enable-large-address-aware --disable-rpath --disable-symvers --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: posix
gcc version 9.2.0 (tdm64-1)

C:\Users\UI>

3.关闭goland工程,重新打开

再次使用go get 下载安装sqlite3

参考

说明

本系列文档记录下最近研究golang 开发windows gui的一些技术要点和操作教程。

walk介绍

今天因项目需要研究下GOLANG的GUI,发现了walk这个好东西,可以实现非常优美的界面程序。but只能在windows下开发

开发文档为:

walk下载

如果下载失败,需要设置代理

1
2
3
4
5
6
7
C:\Users\UI\go\src\ThorGui>go get github.com/lxn/walk
go get github.com/lxn/walk: module github.com/lxn/walk: Get "https://proxy.golang.org/github.com/lxn/walk/@v/list": dial tcp 216.58.200.49:443: connectex: A connection attempt failed because the connected party did not properly resp
ond after a period of time, or established connection failed because connected host has failed to respond.

C:\Users\UI\go\src\ThorGui>go env -w GO111MODULE=on

C:\Users\UI\go\src\ThorGui>go env -w GOPROXY=https://goproxy.cn,direct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
C:\Users\UI\go\src\ThorGui>go get github.com/lxn/walk
go: downloading github.com/lxn/walk v0.0.0-20201110160827-18ea5e372cdb
go: github.com/lxn/walk upgrade => v0.0.0-20201110160827-18ea5e372cdb
go: finding module for package gopkg.in/Knetic/govaluate.v3
go: finding module for package golang.org/x/sys/windows
go: finding module for package github.com/lxn/win
go: downloading gopkg.in/Knetic/govaluate.v3 v3.0.0
go: downloading golang.org/x/sys v0.0.0-20201112073958-5cba982894dd
go: downloading github.com/lxn/win v0.0.0-20201111105847-2a20daff6a55
go: found github.com/lxn/win in github.com/lxn/win v0.0.0-20201111105847-2a20daff6a55
go: found golang.org/x/sys/windows in golang.org/x/sys v0.0.0-20201112073958-5cba982894dd
go: found gopkg.in/Knetic/govaluate.v3 in gopkg.in/Knetic/govaluate.v3 v3.0.0

C:\Users\UI\go\src\ThorGui>

测试

第一个walk main.go程序

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
package main

import (
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
"strings"
)

func main() {
var inTE, outTE *walk.TextEdit // 声明两个文本编辑控件

//主窗口对象
MainWindow{
Title: "windows程序", // 窗口标题设置
MinSize: Size{600, 400}, //窗体的大小
Layout: VBox{}, // 窗体的布局形式
//定义vbox的所有控件
Children: []Widget{ //定义控件
HSplitter{ //水平分割控件
Children: []Widget{ //定义子控件
TextEdit{AssignTo: &inTE},
TextEdit{AssignTo: &outTE, ReadOnly: true},
},
},
PushButton{ //按钮控件
Text: "确定",
OnClicked: func() {
outTE.SetText(strings.ToUpper(inTE.Text()))
},
},
},
}.Run()
}

编译

创建manifest文件,文件名 thorgui.manifest

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="SomeFunkyNameHere" type="win32"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>
</windowsSettings>
</application>
</assembly>

下载rsrc工具

1
2
3
C:\Users\UI\go\src\ThorGui>go get github.com/akavel/rsrc
go: downloading github.com/akavel/rsrc v0.9.0
go: github.com/akavel/rsrc upgrade => v0.9.0

生成.syso文件

1
C:\Users\UI\go\src\ThorGui>rsrc -manifest thorgui.manifest -o thorgui.syso
1
C:\Users\UI\go\src\ThorGui>go build -ldflags="-H windowsgui"  #生成exe文件

运行结果测试

参考报错提示,安装libpg-dev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(tweb_env) root@Thortest:~# pip install psycopg2
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting psycopg2
Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/fd/ae/98cb7a0cbb1d748ee547b058b14604bd0e9bf285a8e0cc5d148f8a8a952e/psycopg2-2.8.6.tar.gz (383 kB)
|████████████████████████████████| 383 kB 14.5 MB/s
ERROR: Command errored out with exit status 1:
command: /root/tweb_env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-t1d0xq5b/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-t1d0xq5b/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-6rwptxzr
cwd: /tmp/pip-install-t1d0xq5b/psycopg2/
Complete output (7 lines):
running egg_info
creating /tmp/pip-pip-egg-info-6rwptxzr/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-6rwptxzr/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-6rwptxzr/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-6rwptxzr/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-6rwptxzr/psycopg2.egg-info/SOURCES.txt'
Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

解决方法

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
(tweb_env) root@Thortest:~# sudo apt-get install libpq-dev # 安装依赖环境
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
postgresql-doc-10
The following NEW packages will be installed:
libpq-dev
0 upgraded, 1 newly installed, 0 to remove and 50 not upgraded.
Need to get 218 kB of archives.
After this operation, 1,096 kB of additional disk space will be used.
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 libpq-dev amd64 10.14-0ubuntu0.18.04.1 [218 kB]
Fetched 218 kB in 0s (3,547 kB/s)
Selecting previously unselected package libpq-dev.
(Reading database ... 135928 files and directories currently installed.)
Preparing to unpack .../libpq-dev_10.14-0ubuntu0.18.04.1_amd64.deb ...
Unpacking libpq-dev (10.14-0ubuntu0.18.04.1) ...
Setting up libpq-dev (10.14-0ubuntu0.18.04.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
(tweb_env) root@Thortest:~# pip install psycopg2 # 再次安装
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting psycopg2
Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/fd/ae/98cb7a0cbb1d748ee547b058b14604bd0e9bf285a8e0cc5d148f8a8a952e/psycopg2-2.8.6.tar.gz (383 kB)
|████████████████████████████████| 383 kB 28.8 MB/s
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... done
Created wheel for psycopg2: filename=psycopg2-2.8.6-cp36-cp36m-linux_x86_64.whl size=420359 sha256=e4038d16f61c8bb594aae8dfc8552bb5adc1d2c08b9b5569d65713ede01a489e
Stored in directory: /root/.cache/pip/wheels/ba/11/64/92ac0a2b09f4e201ec7578bab7d35f3dbd3e07795ee1e18319
Successfully built psycopg2
Installing collected packages: psycopg2
Successfully installed psycopg2-2.8.6

说明

跨域,跨域,跨域。重要的事说三遍,为啥以前解决方法不对呢?以前有测试域名,直接绑定好并且配置django-cors-headers即可。今天遇到情况是部署好django后,什么设置都了还是提示跨域问题!

问题

本地开发环境 vue.js url:http://localhost:8000 服务器在阿里与,ip:端口模式。解析了域名就不会提示,还有一个问题换搜狗浏览器也可以访问,chrome不行。

1
Access to XMLHttpRequest at 'http://39.99.35.80/api/v1/chain/stats' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

解决方法

前期按照以前配置的django,直接使用python manage.py runserver 0.0.0.0:80 没问题。使用nginx代理后就会出现问题。

崩溃中!!!!于是各种找问题。

1.django配置

安装cors模块,切记,切记,要安装2.x版本 https://github.com/adamchainz/django-cors-headers/issues/579

1
pip install django-cors-headers== 2.5.3 # 3.0版本+nginx要踩坑

配置settings.py

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

CORS_ALLOW_CREDENTIALS = True # 指明在跨域访问中,后端是否支持对cookie的操作。
CORS_ORIGIN_ALLOW_ALL = True

CORS_ORIGIN_WHITELIST = (
'*'
)

CORS_ALLOW_METHODS = (
'DELETE',
'GET',
'OPTIONS',
'PATCH',
'POST',
'PUT',
'VIEW',
)

CORS_ALLOW_HEADERS = (
'XMLHttpRequest',
'X_FILENAME',
'accept-encoding',
'authorization',
'content-type',
'dnt',
'origin',
'user-agent',
'x-csrftoken',
'x-requested-with',
'Pragma',
)



INSTALLED_APPS = [
.......
'corsheaders',

]


MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware', # 最好放第一行
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'corsheaders.middleware.CorsPostCsrfMiddleware', # 如果出现csrf,加这个
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

2.nginx配置

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
server {
listen 80;
server_name x.x.x.x;
keepalive_timeout 300;



location / {

client_max_body_size 100m;
proxy_http_version 1.1;
proxy_pass http://127.0.0.1:8000;
proxy_connect_timeout 300s;
proxy_read_timeout 300s;

proxy_buffer_size 1024k;
proxy_buffers 4 1024k;
proxy_busy_buffers_size 1024k;
proxy_temp_file_write_size 1024k;


}


}

参考