Unverified Commit a55dc31c authored by wojiushixiaobai's avatar wojiushixiaobai Committed by GitHub

Merge pull request #1800 from wojiushixiaobai/docs

[Update]增加优化文档
parents 9a3d97f1 50e4bb58
......@@ -7,4 +7,5 @@
quickinstall
step_by_step
setup_by_ubuntu
setup_by_optimization
upgrade
安装后优化文档
--------------------------------
- 能解决部分CPU和内存高占用问题
配置文件调整
~~~~~~~~~~~~~~
::
$ cd /opt/jumpserver
$ vim config.py
# 调整 debug 模式和 log_level
...
DEBUG = os.environ.get("DEBUG") or False
...
LOG_LEVEL = os.environ.get("LOG_LEVEL") or 'ERROR'
...
HTTP_BIND_HOST = '127.0.0.1'
...
$ cd /opt/coco
$ vim conf.py
# 调整 log_level
...
LOG_LEVEL = 'ERROR'
...
# 设置好后重启 jumpserver 和 coco
静态资源 OSS 加速访问
~~~~~~~~~~~~~~~~~~~~~
::
# 先把静态资源上传或同步到 OSS,如果使用其他工具上传,注意设置文件 HTTP 头
# 静态文件夹包括 jumpserver/data/static 和 luna
# Bucket ACL 设置为 公共读
# 防盗链需要添加 Jumpserver域名 和 ossEndPoint域名
# 跨域设置需要添加 Jumpserver域名 和 ossEndPoint域名
# 在最前端的 nginx 代理服务器上进行设置
$ cd /etc/nginx
$ vim conf.d/jumpserver.conf
...
# 根据自己的 OSS 所在地域和 域名,自行替换 yourBucket 和 yourEndPoint
location /static/ {
rewrite ^/static/(.*)$ https://yourBucket.oss-cn-yourEndPoint.aliyuncs.com/static/$1 permanent;
add_header Access-Control-Allow-Origin 'https://yourBucket.oss-cn-yourEndPoint.aliyuncs.com';
access_log off;
}
location ~ /luna/.*\.(svg|eot|ico|woff|woff2|ttf|js|css|png|json|txt)$ {
rewrite ^/luna/(.*)$ https://yourBucket.oss-cn-yourEndPoint.aliyuncs.com/luna/$1 permanent;
add_header Access-Control-Allow-Origin 'https://yourBucket.oss-cn-yourEndPoint.aliyuncs.com';
access_log off;
}
# 设置完成后重启 nginx
......@@ -9,6 +9,7 @@ API 文档
- 手动调用 api 的方法
::
$ curl -X POST -H 'Content-Type: application/json' -d '{"username": "admin", "password": "admin"}' http://localhost/api/users/v1/token/ # 获取token
......@@ -17,8 +18,8 @@ API 文档
$ curl -H 'Authorization: Bearer 937b38011acf499eb474e2fecb424ab3' -H "Content-Type:application/json" http://localhost/api/users/v1/users/
# 使用token访问,token有效期 1小时
- python代码示例
::
import requests
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment