首页
关于
Search
1
LXC中Alpine模板安装Docker
16 阅读
2
Debian 12 / Ubuntu 22.04 安装 Docker 以及 Docker Compose 教程
14 阅读
3
netclient docker compose
12 阅读
4
Netmaker安装
11 阅读
5
PVE 引入img文件作为虚拟机磁盘
10 阅读
默认分类
PVE虚拟机
数据库
容器技术
Linux
登录
Search
标签搜索
SQLSERVER
学习笔记
累计撰写
31
篇文章
累计收到
1
条评论
首页
栏目
默认分类
PVE虚拟机
数据库
容器技术
Linux
页面
关于
搜索到
17
篇与
的结果
2025-03-15
window nginx使用power shell分割日志
在window下使用nginx,一般网上推荐编写bat文件或者lograte的Windows版来分割日志。经过实践,直接使用power shell脚本更加方便,同时也不需要对nginx作出任何操作,提高服务的稳定性。$nginxExePath = "C:\Users\ECSadmin\Documents\nginx-1.27.1.1\nginx.exe" $nginxLogPath = "C:\Users\ECSadmin\Documents\nginx-1.27.1.1\logs\access.log" $nginxRootDir = "C:\Users\ECSadmin\Documents\nginx-1.27.1.1" $backupDir = "D:\logs_backup" $daysToKeep = 10 New-Item -Path $backupDir -ItemType Directory -Force | Out-Null if (Test-Path $nginxLogPath) { $nginxBackupName = "nginx_access_$(Get-Date -Format 'yyyyMMdd').log" Copy-Item $nginxLogPath "$backupDir\$nginxBackupName" -Force Set-Content $nginxLogPath -Value $null -Force } Get-ChildItem $backupDir | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-$daysToKeep) } | Remove-Item -Force
2025年03月15日
2 阅读
0 评论
0 点赞
2025-01-25
Emby 反代后外网访问慢的解决方案
由于一台服务器上部署了多个服务,所以 Emby 只能通过域名区分进行访问。为了解决这个问题,我通过 Nginx 对 Emby 进行反向代理。然而,反代后发现 Emby 在内网可以瞬间加载视频,但在外网加载速度非常慢,甚至会出现视频未播放完就跳跃的问题。问题描述通过抓包分析发现,Nginx 反代 Emby 后,请求媒体的响应状态码是 200;而在内网直接访问(与 Emby 在同一网段)时,请求媒体的响应状态码是 206。Nginx 反代 Emby,此时请求视频媒体的响应状态码是 200:家里直接访问(与 Emby 在同一网段),此时请求视频媒体的响应状态码是 206:状态码解释200 OK:表示请求成功,服务器已成功处理了请求。对于 GET 请求,响应包含所请求的资源。206 Partial Content:表示服务器已成功处理了部分 GET 请求。通常用于支持范围请求,客户端可以请求资源的一个或多个部分。解决方案经过排查发现,这是因为 Nginx 反代 Emby 时进行了缓存,并且不允许只处理部分请求。解决方法是在 Nginx 反代配置中加入如下配置:proxy_buffering off; proxy_set_header Range $http_range; proxy_set_header If-Range $http_if_range;
2025年01月25日
4 阅读
0 评论
0 点赞
2025-01-25
NGINX反代EMBY
原因:洁癖,第三方修改可能存在安全问题。优点:支持原版最新镜像,不修改服务端、不下载第三方插件、不修改客户端,不劫持网络。思路:使用 Nginx 反向代理 Emby,并替换 JS 中激活服务器地址。下面是我使用宝塔反代的Nginx 配置client_max_body_size 5000M; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For '$proxy_add_x_forwarded_for'; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions; proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key; proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version; proxy_cache off; proxy_redirect off; proxy_buffering off; location / { proxy_pass http://192.168.2.1:8096;# Emby服务器地址 proxy_set_header X-Forwarded-For $remote_addr; proxy_ssl_verify off; proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 86400; } location ~* \.(gif|png|jpg|css|js|woff|woff2)$ { proxy_pass http://192.168.2.6:8097; # Emby服务器地址 proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; expires 12h; # 图片缓存浏览器过期时间 } # 替换指定 JS 文件的激活服务器地址为本地 location ^~ /web/modules/emby-apiclient/connectionmanager.js { proxy_pass http://192.168.2.6:8097; # 通用代理头设置 proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 替换激活服务器地址 sub_filter 'https://mb3admin.com/' '/'; sub_filter_once off; # 只替换 JS 类型的文件 sub_filter_types application/javascript application/x-javascript; } # 模拟激活服务器响应 location ^~ /admin/service/registration/validateDevice { default_type application/json; add_header Content-Type application/json; return 200 '{"cacheExpirationDays":365,"message":"Device Valid","resultCode":"GOOD"}'; } # 修正秘钥页面填写问题(可省略) location ^~ /Plugins/SecurityInfo { default_type application/json; add_header Content-Type application/json; return 200 '{"SupporterKey":"请体验后支持正版","IsMBSupporter":true}'; }另外一组普通配置:server { listen 80; server_name xxx.com;#你的域名 client_max_body_size 6000M; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For '$proxy_add_x_forwarded_for'; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions; proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key; proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version; proxy_cache off; proxy_redirect off; proxy_buffering off; location / { proxy_pass http://127.0.0.1:8080;#反代域名 proxy_set_header X-Forwarded-For $remote_addr; proxy_ssl_verify off; proxy_http_version 1.1; proxy_set_header Host 127.0.0.1:8080;#反代域名 proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 86400; } }
2025年01月25日
3 阅读
0 评论
0 点赞
2024-05-02
nginx在vps上使用sytemctl管理的小问题
安装nginx后,采用sytemctl管理,在开始和重启的时候都会提示类似open() "/run/nginx.pid" failed (13: Permission denied)网上搜索发现,很多帖子都在说要检查nginx配置文件中pid位置和service中是否一致。nano /usr/lib/systemd/system/nginx.service nano /etc/nginx/nginx.conf发现pid文件路径没有问题。后来发现一篇文章中提到,在service文件中生成pid文件语句后面加入ExecStartPost=/bin/sleep 0.1意思是延迟0.1秒启动,然后就一切正常了。可能是由于小机子性能比较弱,I/O延迟太大。顺便在启动命令前又加了一句ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf整体文件内容如下:[Unit] Description=nginx - high performance web server Documentation=https://nginx.org/en/docs/ After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/var/run/nginx.pid ExecStartPost=/bin/sleep 0.1 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf ExecReload=/bin/sh -c "/bin/kill -s HUP $(/bin/cat /var/run/nginx.pid)" ExecStop=/bin/sh -c "/bin/kill -s TERM $(/bin/cat /var/run/nginx.pid)" [Install] WantedBy=multi-user.target重启systemctl服务。systemctl daemon-reload就可以正常管理nginx了。
2024年05月02日
5 阅读
0 评论
0 点赞
2024-04-12
netclient docker compose
https://zhuanlan.zhihu.com/p/558769774version: "3.4" services: netclient: network_mode: host privileged: true restart: always environment: - TOKEN=<networktoken> - PORT=<wg interface port> - ENDPOINT=<endpoint ip> - MTU=<mtu> - HOST_NAME=<host name> - IS_STATIC=<static host (true/false)> volumes: - '/etc/netclient:/etc/netclient' container_name: netclient image: 'gravitl/netclient:latest'
2024年04月12日
12 阅读
0 评论
0 点赞
1
2
...
4