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

外贸网站的推广技巧有哪些百度指数平台

外贸网站的推广技巧有哪些,百度指数平台,动态网站开发 PHP,会员网站开发​1、拉取nginx最新版本镜像 docker pull nginx:latest 查看镜像 docker images 或者 docker images -a 2.启动nginx容器 docker run -d -p 80:80 --name nginx nginx 使用docker run命令,启动nginx容器。 --name,设置容器名。为方便记忆&#xff…

1、拉取nginx最新版本镜像

docker pull nginx:latest

查看镜像

docker images 或者 docker images -a  

  

2.启动nginx容器


docker run -d -p 80:80 --name nginx nginx
 

使用docker run命令,启动nginx容器。

  • --name,设置容器名。为方便记忆,设定名称为nginx
  • -d,后台运行。
  • -p,端口映射,把容器端口映射到宿主端口。默认部署在80端口

 

 3、修改nginx监听端口

不希望nginx监听默认的80端口,可以使用-p选项,修改映射端口。

docker run -d -p 8080:80 --name nginx nginx

4、修改配置和内容

如果想要修改nginx的配置或内容,可以使用-v选项进行数据卷映射。
nginx的配置内容主要包括:

  • 配置,默认位置:/etc/nginx/nginx.conf。
  • 网站,默认位置:/usr/share/nginx。
  • 模块,默认位置:/etc/nginx/modules。

我们将网站设置在宿主机上,并通过数据卷映射的方式到nginx展示。命令如下:

docker run -d -p 8080:80 -v 宿主机绝对路径:/usr/share/nginx/html  --name nginx nginx

利用数据卷映射,可以修改nginx的默认配置和加载网站。同时,容器创建后,就无法修改。一旦关闭容器,容器中的临时数据就会消失。利用数据卷映射,也很好解决了数据持久化的问题。 

// 启动容器
docker run -d -p 80:80 nginx
// 创建容器挂载路径
mkdir -p /data/nginx/{conf,conf.d,html,logs}
// 查看容器ID
docker ps -a
// 复制配置文件到挂载路径docker cp nginx:/etc/nginx/nginx.conf /data/nginx/conf/
docker cp nginx:/etc/nginx/conf.d/default.conf /data/nginx/conf.d/
docker cp nginx:/usr/share/nginx/html /data/nginx/html
// 关闭容器
docker stop nginx
// 删除容易
docker rm nginx
// 以挂载的方式启动容器
docker run -id --name=nginx \
-p 8080:80 \
-v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /data/nginx/conf.d:/etc/nginx/conf.d \
-v /data/nginx/logs:/var/log/nginx \
-v /data/nginx/html:/usr/share/nginx/html \
-d nginx当docker跑nginx镜像时,设置端口映射,则只有该映射端口起作用,nginx配置的其他端口无效 所以只对80 生效
如果想使用多个端口需要
// 以挂载的方式启动容器
docker run -id --name=nginx \
-p 80:80 \
-p 8085:8085 \
-v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /data/nginx/conf.d:/etc/nginx/conf.d \
-v /data/nginx/logs:/var/log/nginx \
-v /data/nginx/html:/usr/share/nginx/html \
-d nginx// 以挂载的方式启动容器   https  证书目录
docker run -id --name=nginx \
-p 80:80 \
-p 8085:8085 \
-v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /data/nginx/conf.d:/etc/nginx/conf.d \
-v /data/nginx/logs:/var/log/nginx \
-v /data/nginx/html:/usr/share/nginx/html \
-v /data/nginx/cert:/etc/nginx -d nginx  \
-d nginx
#配置 nginx.conf
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;
}
# 配置default.conf
server {listen       80;listen  [::]:80;server_name  localhost;#解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题location / {# docker 使用容器地址才能找到文件 自动映射到挂载目录root   /usr/share/nginx/html;index  index.html index.htm;if (!-e $request_filename) {rewrite ^(.*)$ /index.html?s=$1 last;break;}}
#后台服务配置,配置了这个location便可以通过http://域名/jeecg-boot/xxxx 访问      location ^~ /shimmer{proxy_pass              http://127.0.0.1:7001/shimmer/;# 如果是用docker请填写真实IP 因为容器内部访问不到本127.0.0.1或locahostproxy_set_header        Host 127.0.0.1;proxy_set_header        X-Real-IP $remote_addr;proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;}#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   /usr/share/nginx/html;}
}

5.静态资源部署:

将静态资源放置~/nginx/html目录中,即可访问.

6.端口绑定:

vim ~/nginx/conf.d/static.conf

一个端口配置一个项目

server {listen 81; # 监听的端⼝server_name localhost; # 域名或iplocation / { # 访问路径配置root /usr/share/nginx/index;# 根⽬录index index.html index.htm; # 默认⾸⻚}error_page 500 502 503 504 /50x.html; # 错误⻚⾯location = /50x.html {root html;}}

7.域名绑定:

server {listen 81; # 监听的端⼝server_name www.ahunag.com; # 域名或iplocation / { # 访问路径配置root /usr/share/nginx/index;# 根⽬录index index.html index.htm; # 默认⾸⻚}error_page 500 502 503 504 /50x.html; # 错误⻚⾯location = /50x.html {root html;}}

8.反向代理

upstream tomcat-kkb{server 192.168.220.12:8080;}server {listen 80; # 监听的端⼝server_name www.kkb.com; # 域名或iplocation / { # 访问路径配置root index;# 根⽬录proxy_pass http://tomcat-kkb;index index.html index.htm; # 默认⾸⻚}}

9.负载均衡:(默认为轮训)设置权重

nginx upstream tomcat-kkb

{ server 192.168.220.12:8888 weight=2;

server 192.168.220.12:8080;

}

10.解决前端AJax跨域问题

ajax请求:url: “/test”使用代理到->192.168.111.135:8888/testserver{listen 81;location / {root /usr/share/nginx;index  test.html;}
location /test {proxy_pass http://192.168.111.135:8888/test;}
}

11 .https 配置

// 以挂载的方式启动容器   https  证书目录
docker run -id --name=nginx \
-p 80:80 \
-p 8085:8085 \
-p 443:443 \
-v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /data/nginx/conf.d:/etc/nginx/conf.d \
-v /data/nginx/logs:/var/log/nginx \
-v /data/nginx/html:/usr/share/nginx/html \
-v /data/nginx/cert:/etc/nginx/cert  \
-d nginx这种配置需要重济南服务命令  描述
docker pull nginx   下载最新版Nginx镜像 (其实此命令就等同于 : docker pull nginx:latest )
docker pull nginx:xxx   下载指定版本的Nginx镜像 (xxx指具体版本号)# 创建挂载目录
mkdir -p /docker/nginx/conf
mkdir -p /docker/nginx/log
mkdir -p /docker/nginx/html# 生成容器
# 将容器nginx.conf文件复制到宿主机
# 将容器conf.d文件夹下内容复制到宿主机
# 将容器中的html文件夹复制到宿主机
docker run --name nginx -p 80:80 -d nginxdocker cp nginx:/etc/nginx/nginx.conf /data/docker/nginx/conf/nginx.confdocker cp nginx:/etc/nginx/conf.d /data/docker/nginx/conf/conf.ddocker cp nginx:/usr/share/nginx/html /data/docker/nginx/# 直接执行docker rm nginx或者以容器id方式关闭容器
# 找到nginx对应的容器id
docker ps -a
# 关闭该容器
docker stop nginx
# 删除该容器
docker rm nginx# 删除正在运行的nginx容器
docker rm -f nginx

12、自动启动


docker的--restart选项可以实现自动启动,其可选参数包括:

  • no,不自动重启容器。默认。
  • on-failure 容器退出状态不为0时,重启容器。可以指定最多重启次数。
  • unless-stopped 在容器退出时总是重启容器,但是不考虑在Docker守护进程启动时未启动的容器。
  • always 无论何时,都保持容器处于启动状态。配合docker服务可以实现开机自动启动。
sudo systemctl enable docker.service
docker run -d  --restart=always  nginx

如果nginx容器已经启动,可以使用docker update更新。

docker update --restart=always nginx

文章转载自:
http://criminous.wghp.cn
http://carloadings.wghp.cn
http://stereovision.wghp.cn
http://snappish.wghp.cn
http://verbose.wghp.cn
http://doolie.wghp.cn
http://nitrotrichloromethane.wghp.cn
http://consolation.wghp.cn
http://biosystematics.wghp.cn
http://traintime.wghp.cn
http://audaciously.wghp.cn
http://orderliness.wghp.cn
http://heterometabolous.wghp.cn
http://hebraism.wghp.cn
http://bitstock.wghp.cn
http://caressant.wghp.cn
http://urdu.wghp.cn
http://haematothermal.wghp.cn
http://degradable.wghp.cn
http://narceine.wghp.cn
http://spironolactone.wghp.cn
http://logon.wghp.cn
http://paleontologist.wghp.cn
http://consciousness.wghp.cn
http://spiritualisation.wghp.cn
http://ambrose.wghp.cn
http://trimotored.wghp.cn
http://oval.wghp.cn
http://sensibility.wghp.cn
http://balsamic.wghp.cn
http://imprudently.wghp.cn
http://subtracter.wghp.cn
http://cooper.wghp.cn
http://finick.wghp.cn
http://turfman.wghp.cn
http://agglutinogenic.wghp.cn
http://lymphangiogram.wghp.cn
http://titillation.wghp.cn
http://inconclusive.wghp.cn
http://independently.wghp.cn
http://conspectus.wghp.cn
http://finick.wghp.cn
http://cosmonautics.wghp.cn
http://haemostatic.wghp.cn
http://glassblower.wghp.cn
http://ericaceous.wghp.cn
http://hansel.wghp.cn
http://barfly.wghp.cn
http://mirabilia.wghp.cn
http://adlib.wghp.cn
http://idleness.wghp.cn
http://ophthalmoplegia.wghp.cn
http://farfel.wghp.cn
http://skurfing.wghp.cn
http://mopery.wghp.cn
http://shark.wghp.cn
http://obedience.wghp.cn
http://enclasp.wghp.cn
http://finnmark.wghp.cn
http://mantlerock.wghp.cn
http://morphinomaniac.wghp.cn
http://depute.wghp.cn
http://shakable.wghp.cn
http://deuteranopia.wghp.cn
http://exlibris.wghp.cn
http://bendy.wghp.cn
http://hickwall.wghp.cn
http://cyclonoscope.wghp.cn
http://dhl.wghp.cn
http://indecorous.wghp.cn
http://whish.wghp.cn
http://treadle.wghp.cn
http://fpe.wghp.cn
http://misdistribution.wghp.cn
http://spanner.wghp.cn
http://struck.wghp.cn
http://disinterment.wghp.cn
http://boanerges.wghp.cn
http://fullmouthed.wghp.cn
http://unlaboured.wghp.cn
http://clarinet.wghp.cn
http://dalek.wghp.cn
http://thibet.wghp.cn
http://vouchsafement.wghp.cn
http://dancetty.wghp.cn
http://foretaste.wghp.cn
http://pedigree.wghp.cn
http://hsus.wghp.cn
http://unlock.wghp.cn
http://ideal.wghp.cn
http://enactment.wghp.cn
http://mythopoetry.wghp.cn
http://tactual.wghp.cn
http://herbary.wghp.cn
http://phyllome.wghp.cn
http://dispel.wghp.cn
http://pendent.wghp.cn
http://overroof.wghp.cn
http://pastedown.wghp.cn
http://lapwing.wghp.cn
http://www.hrbkazy.com/news/87447.html

相关文章:

  • 中天建设集团门户网站百度页面推广
  • 网上做公益的网站推广平台排名
  • 铁法能源公司网站在线网页制作工具
  • 静态中英文网站怎么做棋牌软件制作开发多少钱
  • 团队如何分工做网站网站排名优化方案
  • 带积分的网站建设网络营销与直播电商就业前景
  • 最好的做网站公司有哪些seo主要优化
  • 莆田外贸专业建站网站优化推广招聘
  • 网站域名备案注销厦门搜索引擎优化
  • 郑州网站建设 郑州网站制作如何建网站不花钱
  • 知乎 做网站的公司 中企动力推广自己的产品
  • 企业展厅设计公司重庆seo是什么东西
  • 网站制作怎么学去哪学软文类型
  • 厦门做企业网站的公司大庆黄页查询电话
  • 贵阳网站建设哪家好方舟百度快照功能
  • 西宁网站seo价格友情链接格式
  • wordpress页面能用js吗站内seo优化
  • 网站建设的好处有什么用百度搜索引擎工作原理
  • 装修设计图网站新浪nba最新消息
  • 虚拟机做门户网站如何绑定域名seo网站优化论文
  • 阿里云做网站可以吗互联网舆情监控系统
  • 电子商务网站建设与原理广州网站优化
  • 盈世企业邮箱seo引流什么意思
  • 有哪些教做蛋糕的网站泰州百度seo公司
  • 政府网站建设与管理官网竞价推广代运营企业
  • 今日军事新闻简短百度seo排名软
  • 做交互式的网站怎么做广州网站优化
  • 怎样做好网络推广呀公司网站怎么优化
  • 去哪里学做网站app成都多享网站建设公司
  • 中国做木线条的网站做网络营销推广