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

docker 安装部署 nginx

命令

docker run \
-p 15008:80 \
--name nginx1.21.6 \
-v /iepms/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /iepms/nginx/conf/conf.d:/etc/nginx/conf.d \
-v /iepms/nginx/log:/var/log/nginx \
-v /iepms/nginx/html:/usr/share/nginx/html \
-d 192.168.1.103/base/nginx:1.26.1

nginx 配置文件


#user  nobody;
worker_processes  1;#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {worker_connections  1024;
}http {include       mime.types;default_type  application/octet-stream;#include       ./conf/include/blackIP.conf;include       D:/tool/nginx/nginx-1.26.1/conf/include/blackIP.conf;client_max_body_size 10m;client_body_buffer_size 10m;#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  logs/access.log  main;sendfile        on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout  65;#开启gzipgzip  on;  #低于1kb的资源不压缩 gzip_min_length 1k;#压缩级别1-9,越大压缩率越高,同时消耗cpu资源也越多,建议设置在5左右。 gzip_comp_level 5; #需要压缩哪些响应类型的资源,多个空格隔开。不建议压缩图片.#gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;  #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)gzip_disable "MSIE [1-6]\.";  #是否添加“Vary: Accept-Encoding”响应头gzip_vary on;gzip_typesapplication/atom+xmlapplication/javascriptapplication/jsonapplication/ld+jsonapplication/manifest+jsonapplication/rss+xmlapplication/vnd.geo+jsonapplication/vnd.ms-fontobjectapplication/x-font-ttfapplication/x-web-app-manifest+jsonapplication/xhtml+xmlapplication/xmlfont/opentypeimage/bmpimage/svg+xmlimage/x-icontext/cache-manifesttext/csstext/plaintext/vcardtext/vnd.rim.location.xloctext/vtttext/x-componenttext/x-cross-domain-policy;# 代理服务器upstream backend {ip_hash;server localhost:8089 max_fails=1000 weight=1;server localhost:8088 weight=1000;}server {listen       80;server_name  127.0.0.1;server_name_in_redirect on;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   html/;index  index.html index.htm;}#location /image {#    root   html/;#    index  index.html index.htm;#}#location /image {#    root   html/;#	try_files $uri $uri/ /image/default.jpg; #}location ~* \.(gif|jpg|jpeg|png|bmp)$ {  valid_referers 127.0.0.1;if ($invalid_referer) {return 403;#可以配置成返回一张禁止盗取的图片#rewrite ^/ https://xxxxxxxxxxx}  }location /api {proxy_set_header   X-Real-IP        $remote_addr;proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;proxy_set_header   Host             $http_host;proxy_set_header   X-NginX-Proxy    true;proxy_set_header   Connection "";proxy_http_version 1.1;add_header Access-Control-Allow-Origin *;proxy_pass http://backend/;}  location /iepms_web_test {root   html/;proxy_pass http://192.168.1.126:16008/iepms_web/;try_files $uri $uri/ /iepms_web/default.jpg; }  location /gateway/ {proxy_hide_header X-Frame-Options;add_header X-Frame-Options ALLOWALL;proxy_pass http://127.0.0.1:15000;}#error_page  404              /404.html;# redirect server error pages to the static page /50x.html#error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {#    proxy_pass   http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {#    root           html;#    fastcgi_pass   127.0.0.1:9000;#    fastcgi_index  index.php;#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;#    include        fastcgi_params;#}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {#    deny  all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {#    listen       8000;#    listen       somename:8080;#    server_name  somename  alias  another.alias;#    location / {#        root   html;#        index  index.html index.htm;#    }#}# HTTPS server##server {#    listen       443 ssl;#    server_name  localhost;#    ssl_certificate      cert.pem;#    ssl_certificate_key  cert.key;#    ssl_session_cache    shared:SSL:1m;#    ssl_session_timeout  5m;#    ssl_ciphers  HIGH:!aNULL:!MD5;#    ssl_prefer_server_ciphers  on;#    location / {#        root   html;#        index  index.html index.htm;#    }#}}
http://www.lryc.cn/news/471772.html

相关文章:

  • 黑马数据库学习笔记
  • MYSQL-SQL-03-DQL(Data Query Language,数据查询语言)(单表查询)
  • 【数据结构和算法】三、动态规划原理讲解与实战演练
  • 交叉编译 perl-5.40.0(riscv64)
  • Leetcode 搜索旋转排序数组
  • Spring Task—定时任务
  • Spring Boot 应用开发概述
  • Chrome谷歌浏览器加载ActiveX控件之allWebDesktop控件介绍
  • GitHub Star 数量前 5 的开源应用程序生成器
  • DBC文件当中新建CANFD等类型的报文
  • 基于SpringBoot的房地产销售管理系统【附源码】
  • 圆点虚线 Android
  • 贵州鑫宏远农业-始终致力于推动现代农业的科技创新与发展
  • 程序员做销售,从代码到客户的逆袭之路
  • Flink CDC系列之:理解学习Kubernetes模式
  • git合并相关操作详解
  • 前端经典【面试题】持续更新HTML、CSS、JS、VUE、FLUTTER、性能优化等
  • 【Linux知识】linux磁盘管理深入了解
  • Qt Essential Classes
  • 小小猫棒onu替换家用光猫,薅运营商带宽羊毛,突破1000M
  • 软件测试学习笔记丨Selenium学习笔记:css定位
  • python数据处理常用操作
  • 解决minio跨域问题
  • python 跳过当前循环
  • 数据库数据恢复—Oracle ASM磁盘组掉线 ,ASM实例无法挂载的数据恢复案例
  • jupyter notebook改变默认启动路径
  • libevent源码剖析-基本数据结构
  • 往期文章汇总——射频测量+无线通信+软件无线电+6G科普
  • 微信小程序 - 深 / 浅拷贝实现方法,微信小程序深拷贝与浅拷贝,函数方法封装直接调用使用,深拷贝cloneDeep和浅拷贝clone(深复制和浅复制)
  • Log4Net配置详解及输出自定义消息类示例代码