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

网站降权投诉个人网页在线制作

网站降权投诉,个人网页在线制作,网站界面分析,网站开发项目流程本文介绍docker nginx官方镜像使用方法,因为第一次用,在加上对docker也不是很熟,中间踩了一些坑,为了避免下一次用又踩坑,因此记录如下,也希望能够帮到其它小伙伴。 官方镜像页面:https://hub.d…

        本文介绍docker nginx官方镜像使用方法,因为第一次用,在加上对docker也不是很熟,中间踩了一些坑,为了避免下一次用又踩坑,因此记录如下,也希望能够帮到其它小伙伴。

        官方镜像页面:https://hub.docker.com/_/nginx

        镜像拉取 docker pull nginx

        拉取镜像后可以启动镜像 docker run --name nginx -p 80:80 -d 1ee494ebb83f

        但是光启动镜像,用处不大,因为首先你需要有个有意义的配置文件才比较有用。

        不过也不是一点儿用处没有,至少你可以用它验证你的nginx配置文件有没有错,比如这样:docker exec nginx(容器名称) nginx -t -c /tmp/nginx.conf

        下面就来讲讲配置文件,是我踩坑比较多的地方,我配置文件大概是这样的,中间隐去了我项目中的一些具体内容,不过没关系,不妨碍演示:

user admin;
worker_processes auto;
error_log /home/admin/nginx/logs/nginx_error.log warn;
pid /home/admin/nginx/logs/nginx.pid;
worker_rlimit_nofile 65535;events {use epoll;worker_connections 65535;
}http {include mime.types;default_type application/octet-stream;server_tokens off;log_format main '$remote_addr - $remote_user [$time_local] ''"$request" $status $bytes_sent ''"$http_j_forwarded_for" "$http_x_forwarded_for" ''"$http_referer" "$http_user_agent" ''"$gzip_ratio"';# charset utf-8;server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 300m;sendfile on;tcp_nopush on;keepalive_timeout 0;tcp_nodelay on;client_body_buffer_size 512k;fastcgi_intercept_errors on;proxy_connect_timeout 90;proxy_read_timeout 180;proxy_send_timeout 180;proxy_buffer_size 256k;proxy_buffers 4 256k;proxy_busy_buffers_size 256k;proxy_temp_file_write_size 256k;proxy_intercept_errors on;server_name_in_redirect off;proxy_hide_header X-Powered-By;gzip on;gzip_min_length 100;gzip_buffers 4 16k;gzip_http_version 1.0;gzip_comp_level 9;gzip_types text/plain application/x-javascript application/javascript text/javascript text/css application/xml application/json;gzip_vary on;gzip_proxied any;error_page 400 401 402 403 404 405 408 410 412 413 414 415 500 501 502 503 506 = http://www.xx.com/error.html;server {listen 80;server_name localhost;location /web {alias /home/admin/api;}access_log /home/admin/nginx/logs/api_access.log;error_log /home/admin/nginx/logs/api_error.log;}
}

        我是这么启动镜像的
docker run --name nginx -p 80:80 -v /home/admin/nginx/api.conf:/etc/nginx/conf.d/default.conf -d 1ee494ebb83f
        我启动的时候,把我的nginx配置文件放到了/home/admin/nginx/api.conf 下,并把它映射到了容器的/etc/nginx/conf.d/default.conf文件上,但是这样启动的时候,容器启动不起来,启动报错信息可以用命令 docker logs nginx(容器名称)看到。

        报错原始信息我没有记录下来,意思是说配置文件开头的user admin;这一行不合法,出现在了不该出现的位置。但是我明明用nginx -t -c 验证过的。我把user admin 这行注释掉了,然后docker start nginx 发现还是起不来,查看日志说 worker_processes auto; 这一行不合法,出现在了不应该出现的位置。

        我想了下,觉得肯定是我没明白docker nginx容器的启动方式,然后我大模型了一下,果然,nginx启动的时候,默认会加载/etc/nginx/nginx.conf下的配置文件,这个文件内容大概是这样的

user  nginx;
worker_processes  auto;error_log  /var/log/nginx/error.log warn;
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;keepalive_timeout  65;include /etc/nginx/conf.d/*.conf;
}

        这个文件会include /etc/nginx/conf.d/*.conf;怪不得说我配置文件格式不对呢。

        然后我把配置文件修改成了两部分,一部分作为nginx.conf,一部分作为default.conf, nginx.conf如下:

user admin;
worker_processes auto;
error_log /home/admin/nginx/logs/nginx_error.log warn;
pid /home/admin/nginx/logs/nginx.pid;
worker_rlimit_nofile 65535;events {use epoll;worker_connections 65535;
}http {include mime.types;default_type application/octet-stream;server_tokens off;log_format main '$remote_addr - $remote_user [$time_local] ''"$request" $status $bytes_sent ''"$http_j_forwarded_for" "$http_x_forwarded_for" ''"$http_referer" "$http_user_agent" ''"$gzip_ratio"';# charset utf-8;server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 300m;sendfile on;tcp_nopush on;keepalive_timeout 0;tcp_nodelay on;client_body_buffer_size 512k;fastcgi_intercept_errors on;proxy_connect_timeout 90;proxy_read_timeout 180;proxy_send_timeout 180;proxy_buffer_size 256k;proxy_buffers 4 256k;proxy_busy_buffers_size 256k;proxy_temp_file_write_size 256k;proxy_intercept_errors on;server_name_in_redirect off;proxy_hide_header X-Powered-By;gzip on;gzip_min_length 100;gzip_buffers 4 16k;gzip_http_version 1.0;gzip_comp_level 9;gzip_types text/plain application/x-javascript application/javascript text/javascript text/css application/xml application/json;gzip_vary on;gzip_proxied any;error_page 400 401 402 403 404 405 408 410 412 413 414 415 500 501 502 503 506 = http://www.xx.com/error.html;
}

        另一部分作为default.conf(文件名api.conf)的配置如下:

server {listen 80;server_name localhost;location /web {alias /home/admin/api;}access_log /home/admin/nginx/logs/api_access.log;error_log /home/admin/nginx/logs/api_error.log;}

        然后我用这个命令启动:docker run --name nginx -p 80:80 -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf -v $(pwd)/api.conf:/etc/nginx/conf.d/default.conf -d 1ee494ebb83f

        这次终于不报错格式不对了,但是报错/home/admin/nginx/logs/目录不存在,报错原因是nginx容器中没有这个目录,解决方法是把本地目录挂载到docker中,启动命令我修改成了这样 :docker run --name nginx -p 80:80 -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf -v $(pwd)/api.conf:/etc/nginx/conf.d/default.conf -v /home:/home -d 1ee494ebb83f

        我启动了一把,还是报错,报错的意思是说/etc/mime.types文件不存在,指向这一行代码 include mime.types;我查看了一下,我宿主机中有这个文件,于是我又修改了一把启动命令:docker run --name nginx -p 80:80 -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf -v $(pwd)/api.conf:/etc/nginx/conf.d/default.conf -v /home:/home -v /etc/mime.types:/etc/mime.types -d 1ee494ebb83f

        这次终于起来了!


文章转载自:
http://guidon.c7500.cn
http://krooman.c7500.cn
http://teratogeny.c7500.cn
http://phoenicaceous.c7500.cn
http://fcis.c7500.cn
http://visor.c7500.cn
http://phleboid.c7500.cn
http://stomata.c7500.cn
http://cack.c7500.cn
http://waylay.c7500.cn
http://isostemony.c7500.cn
http://gawk.c7500.cn
http://brocatelle.c7500.cn
http://yes.c7500.cn
http://landside.c7500.cn
http://keloid.c7500.cn
http://latinic.c7500.cn
http://bobwhite.c7500.cn
http://nougatine.c7500.cn
http://photopolarimeter.c7500.cn
http://yorker.c7500.cn
http://sippet.c7500.cn
http://hydrae.c7500.cn
http://simpatico.c7500.cn
http://subtotal.c7500.cn
http://fibrocystic.c7500.cn
http://hosen.c7500.cn
http://polycentric.c7500.cn
http://dashed.c7500.cn
http://impressionable.c7500.cn
http://christingle.c7500.cn
http://groovelike.c7500.cn
http://semihoral.c7500.cn
http://alkalescent.c7500.cn
http://ferrous.c7500.cn
http://redesign.c7500.cn
http://ameslan.c7500.cn
http://iberis.c7500.cn
http://myristic.c7500.cn
http://ideologism.c7500.cn
http://xenolalia.c7500.cn
http://osteomalacia.c7500.cn
http://clamer.c7500.cn
http://jn.c7500.cn
http://handwringing.c7500.cn
http://unofficial.c7500.cn
http://tintinnabulation.c7500.cn
http://capitation.c7500.cn
http://clone.c7500.cn
http://visla.c7500.cn
http://pentanol.c7500.cn
http://ephebe.c7500.cn
http://reproval.c7500.cn
http://foolish.c7500.cn
http://counsellor.c7500.cn
http://hexaplarian.c7500.cn
http://cs.c7500.cn
http://binche.c7500.cn
http://milady.c7500.cn
http://pigeonhearted.c7500.cn
http://nomistic.c7500.cn
http://counterpane.c7500.cn
http://reprehensive.c7500.cn
http://thionyl.c7500.cn
http://microfaction.c7500.cn
http://rhombohedron.c7500.cn
http://pandanaceous.c7500.cn
http://scrappy.c7500.cn
http://bedim.c7500.cn
http://eggshell.c7500.cn
http://sanitarist.c7500.cn
http://plump.c7500.cn
http://puffball.c7500.cn
http://roading.c7500.cn
http://kibutz.c7500.cn
http://dissert.c7500.cn
http://extenuating.c7500.cn
http://restoration.c7500.cn
http://aisne.c7500.cn
http://hypertext.c7500.cn
http://patristic.c7500.cn
http://coloury.c7500.cn
http://acidfast.c7500.cn
http://wheelwork.c7500.cn
http://dandify.c7500.cn
http://preservice.c7500.cn
http://bebeeru.c7500.cn
http://traitor.c7500.cn
http://jewelly.c7500.cn
http://lashio.c7500.cn
http://actinic.c7500.cn
http://vitular.c7500.cn
http://geotropic.c7500.cn
http://eocene.c7500.cn
http://fluorometry.c7500.cn
http://restiveness.c7500.cn
http://alyssum.c7500.cn
http://whippy.c7500.cn
http://monochasial.c7500.cn
http://orpington.c7500.cn
http://www.zhongyajixie.com/news/78075.html

相关文章:

  • 什么网站可以做兼职网站制作方案
  • 学院网站建设的意义阿里指数查询入口
  • 网站登录 退出怎么做惠州百度seo排名
  • 网站开发可行性制作app平台需要多少钱
  • 一个公司做两个网站的多吗石家庄市人民政府官网
  • aspnet网站开发工具搭建网站的五大步骤
  • 家具网站建设方案潍坊做网站哪家好
  • 北京工商局网站如何做股东变更网址之家
  • 玉山县建设局网站淘宝运营培训班
  • 做网站价格多少营销型网站建站
  • 现在还有企业做网站吗如何免费自己创建网站
  • 小型企业网站开发公司360优化大师app
  • 网站分页需要前端做还是后端电商详情页模板免费下载
  • 青岛市最大的网络公司是哪里seo优化轻松seo优化排名
  • 网站建设知识网络营销步骤
  • 云南建设厅网站工程师淘宝数据分析工具
  • 图片二维码制作网站微信引流主动被加软件
  • 教育与培训网站建设济南新闻头条最新事件
  • 在建设厅网站上查询注销建造师网站制作公司排名
  • 做门户网站可以用的字体店铺推广软文300字
  • 个人做网站被骗接app推广的单子在哪接
  • 北控京奥建设有限公司网站制作网站的软件
  • 南京哪里有做公司网站的客户关系管理
  • 专业做电子的外贸网站网络营销模式有哪些?
  • 做汽配的 哪一个网站比较好360广告投放平台
  • wap网站怎么做全网最好的推广平台
  • 做网站基本教程北京网站优化效果
  • wordpress 访问页面空白排名优化关键词公司
  • 用仿网站做优化有效果吗什么广告推广最有效果
  • 站酷网网址搜索引擎优化常用方法