nginx生成https 证书-基于docker-compose
申请的证书存放nginx的docker-compose.yml同一目录
[root@k8s-node1 nginx]# cat docker-compose.yml version: '2' services: nginx: container_name: nginx image: nginx restart: always volumes: - "./default.conf:/etc/nginx/conf.d/default.conf" - "./nginx.conf:/etc/nginx/nginx.conf" - "./oetsky.com.crt:/etc/nginx/oetsky.com.crt" - "./oetsky.com.key:/etc/nginx/oetsky.com.key" ports: - "80:80" - "30080:30080"
[root@k8s-node1 nginx]# cat default.conf server { listen 30080 ssl ; server_name mgedu.com; ssl_certificate oetsky.com.crt; ssl_certificate_key oetsky.com.key; charset utf-8; #location ~* \.(css|js|png|jpg|jpeg|gif|gz|svg|mp4|ogg|ogv|webm|htc|xml|woff)$ { # add_header Cache-Control max-age=604800; # 不起作用 # } location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; index index.html index.htm; if ($request_filename ~* .*\.(htm|html)$){ add_header Cache-Control "no-store"; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
2022-10-10 哈哈 之前忘记收藏了
2021-10-10 redolog落盘机制
2021-10-10 MySQL中Redo Log相关的重要参数总结
2021-10-10 mysql之innodb_buffer_pool