安装
https://gper.club/articles/7e7e7f7ff3g5agc0g6b
常用指令
日志
logs/access.log
logs/error.log
虚拟主机
代理
正向代理
为客户端工作,与客户端一体,隐藏了客户端
反向代理
为服务端工作,与服务端一体,隐藏了服务端
location匹配
负载均衡
upstream
第三方模块:fair <https://gper.club/articles/7e7e7f7ff3g5dgc2g6d> 响应世间
动静分离
限流
- 速率
- 并发量
黑名单
include black.conf
问题1:
- 描述
前端vue工程build后的dist路径下有.gz压缩文件,使用docker打nginx镜像后无法加载页面。 - 解决方式
在nginx配置文件中server部分中添加以下配置:
#Gzip相关配置
gzip on;
gzip_comp_level 5;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_proxied any;
gzip_vary on;
gzip_types application/javascript application/x-javascript text/javascript text/css text/xml application/xhtml+xml application/xml application/atom+xml application/rdf+xml application/rss+xml application/geo+json application/json application/ld+json application/manifest+json application/x-web-app-manifest+json image/svg+xml text/x-cross-domain-policy;
gzip_static on;
gzip_disable "MSIE [1-6]\.";
#end Gzip相关配置