当前位置: 首页 > news >正文

nginx.conf模版

1、无ssl证书模版
worker_processes  1;pid /run/nginx.pid;events {worker_connections  1024;
}http {include       mime.types;default_type  application/json;sendfile        on;keepalive_timeout  65;server {listen            80;listen            [::]:80;server_name       www.xxx.com;# 前端静态资源location / {root   /usr/share/nginx/html/lifecolor;try_files $uri $uri/ /index.html;# 不加刷新会404index  index.html index.htm;}# 转发后端location ^~/prod-api/ {proxy_pass http://lifecolor:8080/;}}
}
2、有ssl证书模版
user  nginx;
worker_processes  auto;error_log  /var/log/nginx/error.log notice;
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  /var/log/nginx/access.log  main;sendfile        on;#tcp_nopush     on;keepalive_timeout  65;#gzip  on;include /etc/nginx/conf.d/*.conf;server {listen  80;listen  [::]:80;server_name  www.xxx.com;rewrite ^(.*) https://$server_name$1 permanent;}server {listen  443 ssl;server_name  xxx.com;# 注意证书文件名字和位置,是从/etc/nginx/下开始算起的ssl_certificate        /etc/nginx/certs/${server_name}/fullchain.cer;ssl_certificate_key    /etc/nginx/certs/${server_name}/${server_name}.key;ssl_session_cache    shared:SSL:1m;ssl_session_timeout  5m;ssl_ciphers  HIGH:!aNULL:!MD5;ssl_prefer_server_ciphers  on;location / {proxy_set_header   X-Real-IP         $remote_addr;proxy_set_header   Host              $http_host;proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;root   /usr/share/nginx/html/lifecolor;try_files $uri $uri/ /index.html;# 不加刷新会404index  index.html index.htm;}location ^~/prod-api/ {proxy_pass http://lifecolor:8080/;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   /usr/share/nginx/html;}}
}

http://www.lryc.cn/news/593491.html

相关文章:

  • 基于GEE与哨兵2号的土地覆盖分类方法及实现
  • python网络爬虫之selenium库(二)
  • uview-ui使用u-row+u-avatar居中布局
  • uview-ui使用u-icon文字图标展示
  • react+antd 可拖拽模态框组件
  • Python之--元组
  • RabbitMQ01——基础概念、docker配置rabbitmq、内部执行流程、五种消息类型、测试第一种消息类型
  • Java学习--------消息队列的重复消费、消失与顺序性的深度解析​
  • I/O 多路复用select,poll
  • Java 中的继承与多态
  • 5.组合模式
  • 3.5软件开发活动[2-系统设计]面向对象设计-UML统一开发过程
  • [故障诊断方向]SNNs:针对小样本轴承故障诊断的孪生神经网络模型
  • 在Vscode中使用Kimi K2模型:实践指南,三分钟生成个小游戏
  • 练习三:熟知前端知识
  • 目标检测中的标签分配算法总结
  • MinIO深度解析:从核心特性到Spring Boot实战集成
  • Vue的路由模式的区别和原理
  • 《Qt5串口开发》搭建跨平台通信系统
  • VSCode用Python操作MySQL:环境配置与代码验证
  • 操作系统-分布式同步
  • 实验室危险品智能管控:行为识别算法降低爆炸风险
  • Mybatis学习之简介(一)
  • Vue 3 中封装并使用 IndexedDB 的完整教程(含泛型、模块化、通用 CRUD)
  • Vue Swiper组件
  • 93.数字信号处理相关的一些问题
  • 单元测试学习+AI辅助单测
  • 【ArcGIS技巧】最近分享的GIS插件总结与优化
  • Spring MVC源码分析 DispatcherServlet#getHandlerAdapter方法
  • LVS四种工作模式深度解析