vault backup: 2025-12-04 09:12:56

This commit is contained in:
杜鹏飞
2025-12-04 09:12:56 +08:00
commit 71e83861de
300 changed files with 339584 additions and 0 deletions

105
技术探究/nginx.md Normal file
View File

@@ -0,0 +1,105 @@
1. 虚拟机用途API接入服务器虚拟机主机名datasecurity_nginx1
部署位置:/data/security/soft/
安装版本nginx-1.18.0.tar.gz
部署步骤:
解压安装包tar -zxvf nginx1.18.0.tar.gz
进入解压成功的目录cd nginx
进行自定义配置
./configure \
--prefix=/data/security/soft/nginx \
--conf-path=/data/security/soft/nginx/conf/nginx.conf \
--pid-path=/data/security/soft/nginx/conf/nginx.pid \
--lock-path=/data/security/soft/nginx/lock/nginx.lock
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
编译make
编译安装make install
### 重定向
location / {
rewrite '' /opt/manage permanent;
}
websocket 长连接 转发
```
location 中加入 以下配置
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
```
### SSL 证书申请
![[nginx ssl 自签名证书配置.pdf]]
### ng 部署环境静态文件加载失败 MIME type
https://blog.csdn.net/yanglangdan/article/details/107833650
由于最近在部署 CI 的项目,静态的 css 一直没有生效,导致部分格式错误
具体错误提示为:
Error: The stylesheet http://example.com/style.css was not loaded
because its MIME type, "text/html", is not "text/css".
错误原因: http Header Content-Type没有指定文件类型
解决方式:
1. 查看 nginx.conf 文件中http{ } 内是否有
include mime.types;
default_type application/octet-stream;
没有就添加。 但 一般都有这个,只是确认下而已,所以不用做什么修改;
2. 手动添加Header Content-Type文件类型
location ~ \.css {
access_log logs/css.access.log;
error_log logs/css.error.log;
root /data/**/**/;
index index.htm index.html index.php;
add_header Content-Type text/css;
}
## 记住如果有指定默认root 路径,一定要添加,不然就找不到静态文件,报 404
## 静态 资源 目录
location /WW_verify_HChUdHAFH0uRShMS.txt {
root /data01/temp/verify;
}
location ~ \.js {
root ****;
add_header Content-Type application/x-javascript;
}
### vhost 解决
>与 server 平级
>include /data01/nginx/conf/vhost/*.conf;
### nginx 413 request too large
http 下 `client_max_body_size 500m;`
### 验证 防爬虫 扫描
[Nginx - 配置 Nginx auth\_basic 身份验证\_努力的一行的博客-CSDN博客\_nginx 身份验证](https://blog.csdn.net/qq_44633541/article/details/124370705)
```
Nginx 配置 http basic 验证
```
### 可视化界面项目
https://github.com/NginxProxyManager/nginx-proxy-manager
https://github.com/cym1102/nginxWebUI
https://github.com/jvns/nginx-playground
###