1 Star 0 Fork 12

江柄伸/api-test-api

forked from zhongYeHai/api-test-api 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
nginx.conf 2.20 KB
一键复制 编辑 原始数据 按行查看 历史
zhongyehai 提交于 2021-06-01 22:28 . 第一次提交
user nginx;
worker_processes 1;
error_log /test/api-test/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 /test/api-test/access.log main; # 路径自定义
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
# 开启gzip
gzip on;
# 启用gzip压缩的最小文件,小于设置值的文件将不会压缩
gzip_min_length 1k;
# gzip 压缩级别,1-10,数字越大压缩的越好,也越占用CPU时间。一般设置1和2
gzip_comp_level 4;
gzip_static on;#是否开启gzip静态资源
# 进行压缩的文件类型。javascript有多种形式。其中的值可以在 mime.types 文件中找到。
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
# 是否在http header中添加Vary: Accept-Encoding,建议开启
gzip_vary on;
# 禁用IE 6 gzip
gzip_disable "MSIE [1-6]\.";
# 设置缓存路径并且使用一块最大100M的共享内存,用于硬盘上的文件索引,包括文件名和请求次数,每个文件在1天内若不活跃(无请求)则从硬盘上淘汰,硬盘缓存最大10G,满了则根据LRU算法自动清除缓存。
proxy_cache_path /home/nginx levels=1:2 keys_zone=imgcache:100m inactive=1d max_size=10g;
#include /etc/nginx/conf.d/*.conf;
server {
listen 80; # nginx监听端口
server_name api-test;
charset utf-8;
client_max_body_size 75M;
# /开头的请求的转发地址
location / {
root /test/api-test/web/ApiTestWeb-master/dist/; # 前端dist包的位置
index index.html;
}
# /api开头的请求的转发地址
location ^~ /api{
proxy_pass http://10.28.200.210:8024/api; # 此处需写明ip地址,用127.0.0.1时无效
}
location /files {
alias /home/files/;
autoindex on;
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/the-river-stem-extends/api-test-api.git
git@gitee.com:the-river-stem-extends/api-test-api.git
the-river-stem-extends
api-test-api
api-test-api
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385