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

网站设计技巧互联网去哪里学

网站设计技巧,互联网去哪里学,做网站 然后百度推广,dj音乐网站建设要通过 nginx 和 sshd 实现文件的上传和下载,通常的做法是结合 SSH 协议和 HTTP 协议,使用 nginx 提供 Web 服务器功能,同时使用 sshd(即 SSH 服务)来处理通过 SSH 协议进行的文件传输。 SSH 实现文件的上传和下载&…

要通过 nginxsshd 实现文件的上传和下载,通常的做法是结合 SSH 协议和 HTTP 协议,使用 nginx 提供 Web 服务器功能,同时使用 sshd(即 SSH 服务)来处理通过 SSH 协议进行的文件传输。

  • SSH 实现文件的上传和下载: 通过 sshd 实现文件上传和下载通常使用 SCP 或 SFTP 协议。你可以通过 SSH 客户端将文件上传到服务器,或从服务器下载文件。这个过程不依赖于 nginx,但你可以通过 nginx 提供 Web 界面来管理文件传输。

  • nginx 提供 Web 界面进行文件上传和下载: nginx 本身并不直接处理文件上传功能,但你可以配合一些后端服务(如 PHP、Python、Node.js 等)来实现文件上传和下载的 Web 界面。

一、准备工作

思路

在同个pod部署nginx和sshd服务,然后共享一个存储卷即可

准备nginx和ssd的镜像

docker pull nginx:stable-alpine
docker pull circleci/sshd:0.1

共享目录

/usr/share/nginx/html

示意图
在这里插入图片描述

二、配置共享存储

创建一个 PVC 来请求共享存储

[root@node1.local ~]# nginx-ssh-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: shared-pvc
spec:accessModes:- ReadWriteMany  # 允许多个容器读写同一存储resources:requests:storage: 5Gi  # 存储大小可以根据需要调整

部署 PVC

kubectl apply -f nginx-ssh-pvc.yaml

三、sshd打docker镜像

#查看目录
[root@node1.local sshd]# ll
total 20
drwxr-xr-x  2 root root 4096 Dec 24 13:50 ./
drwx------ 33 root root 4096 Dec 30 16:52 ../
-rw-r--r--  1 root root  174 Dec 24 12:00 Dockerfile
-rw-r--r--  1 root root  591 Dec 24 11:48 shadow
-rw-r--r--  1 root root  140 Dec 24 13:32 sshd_config#生成加密密码
[root@node1.local sshd]# openssl passwd -6
Password: 
Verifying - Password: 
$6$YiALKQwJcDubTbBn$OEKLYvJfA8vkXAbgCGqTonP.hz5v4/gDcdvDJx0xHGiHlU.Obqpgji0m5tt1vHcTsUlqnFaMSzNiBlnn0USQZ0#设置root密码
[root@node1.local sshd]# cat shadow 
root:$6$YiALKQwJcDubTbBn$OEKLYvJfA8vkXAbgCGqTonP.hz5v4/gDcdvDJx0xHGiHlU.Obqpgji0m5tt1vHcTsUlqnFaMSzNiBlnn0USQZ0:20081:0:::::
bin:!::0:::::
...#将配置文件添加到容器
[root@node1.local sshd]# cat sshd_config 
UsePAM yes
PasswordAuthentication yes
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PermitRootLogin yes
AllowTcpForwarding yes

编写dockerfile

[root@node1.local sshd]# cat Dockerfile 
FROM harbor.cherry.com/sshd/sshd:0.1COPY shadow /etc/shadow
COPY sshd_config /etc/ssh/sshd_configENV TZ=Asia/ShanghaiRUN chmod 640 /etc/shadow

打镜像

docker build -t . sshd:v2

推送harbor仓库

docker tag sshd:v2 harbor.cherry.com/sshd/sshd:2
docker push harbor.cherry.com/sshd/sshd:2

四、部署 Nginx 和 SSH

在同个pod中来运行 Nginx 和 SSH 服务,并使用共享的 PVC 挂载文件存储

[root@node1.local ~]# nginx-ssh-pod.yaml
apiVersion: v1
kind: Pod
metadata:name: nginx-ssh-pod
spec:containers:- name: nginximage: nginx:stable-alpine  # 使用官方 Nginx 镜像ports:- containerPort: 80volumeMounts:- name: shared-storagemountPath: /usr/share/nginx/html  # 共享目录,用于提供文件下载- name: sshimage: harbor.cherry.com/sshd/sshd:2  # 使用自定义的 SSH 镜像ports:- containerPort: 22volumeMounts:- name: shared-storagemountPath: /usr/share/nginx/html  # 共享目录,用于文件上传volumes:- name: shared-storagepersistentVolumeClaim:claimName: shared-pvc  # 使用上面创建的 PVC

此配置文件定义了一个包含两个容器的 Pod:

  • Nginx 容器:它提供文件下载服务,将 /usr/share/nginx/html 目录挂载到共享存储。
  • SSH 容器:它提供文件上传服务,将/usr/share/nginx/html目录挂载到共享存储

部署pod

kubectl apply -f nginx-ssh-pod.yaml

五、暴露 Nginx 和 SSH 服务

创建 Nginx Service

[root@node1.local ~]# nginx-service.yaml
apiVersion: v1
kind: Service
metadata:name: nginx-service
spec:selector:app: nginx-ssh-podports:- protocol: TCPport: 80targetPort: 80type: LoadBalancer

创建 SSH Service

[root@node1.local ~]# ssh-service.yaml
apiVersion: v1
kind: Service
metadata:name: ssh-service
spec:selector:app: nginx-ssh-podports:- protocol: TCPport: 22targetPort: 22type: LoadBalancer 

六、访问使用

  • 文件下载:可以通过直接访问web界面 http:///files/来下载文件。
  • 文件上传:可以通过winscp来实现上传文件

文章转载自:
http://dinncomagdalene.tpps.cn
http://dinncobestridden.tpps.cn
http://dinncoperisperm.tpps.cn
http://dinncocaseworm.tpps.cn
http://dinncoflattering.tpps.cn
http://dinncoanatomist.tpps.cn
http://dinncohoral.tpps.cn
http://dinncominever.tpps.cn
http://dinncolasque.tpps.cn
http://dinncobehold.tpps.cn
http://dinncobrazenly.tpps.cn
http://dinncofishworks.tpps.cn
http://dinncovile.tpps.cn
http://dinncoreligionist.tpps.cn
http://dinncoelectrize.tpps.cn
http://dinncobalaam.tpps.cn
http://dinncocamelopardalis.tpps.cn
http://dinncodecimate.tpps.cn
http://dinncoelectrolyse.tpps.cn
http://dinncocontiguous.tpps.cn
http://dinncosolfeggio.tpps.cn
http://dinncobipinnate.tpps.cn
http://dinncopolacre.tpps.cn
http://dinncoproudly.tpps.cn
http://dinncothyroidotomy.tpps.cn
http://dinncoundignify.tpps.cn
http://dinncohommock.tpps.cn
http://dinncobumblebee.tpps.cn
http://dinncolactary.tpps.cn
http://dinncopterygotus.tpps.cn
http://dinncoteak.tpps.cn
http://dinncobufadienolide.tpps.cn
http://dinncopatristic.tpps.cn
http://dinncoreiver.tpps.cn
http://dinncohello.tpps.cn
http://dinncochemise.tpps.cn
http://dinncomischief.tpps.cn
http://dinncotrihedral.tpps.cn
http://dinncoautoconditioning.tpps.cn
http://dinncolordy.tpps.cn
http://dinncoaaup.tpps.cn
http://dinncostrepitant.tpps.cn
http://dinncomvd.tpps.cn
http://dinncoreinstatement.tpps.cn
http://dinncoforgive.tpps.cn
http://dinncokenyanization.tpps.cn
http://dinncolatinism.tpps.cn
http://dinncoslaw.tpps.cn
http://dinncoorganophosphorous.tpps.cn
http://dinncofireboard.tpps.cn
http://dinncodyspnea.tpps.cn
http://dinncoschmooze.tpps.cn
http://dinncopickoff.tpps.cn
http://dinncopensively.tpps.cn
http://dinncointerpolation.tpps.cn
http://dinncoesculent.tpps.cn
http://dinncogirder.tpps.cn
http://dinncourethra.tpps.cn
http://dinncomeniscus.tpps.cn
http://dinncodespotically.tpps.cn
http://dinncocestode.tpps.cn
http://dinncood.tpps.cn
http://dinncoblastocele.tpps.cn
http://dinncoselenosis.tpps.cn
http://dinncomultipartite.tpps.cn
http://dinncorevertase.tpps.cn
http://dinncoalkyd.tpps.cn
http://dinncopolyphyleticism.tpps.cn
http://dinncoscanning.tpps.cn
http://dinncosenate.tpps.cn
http://dinncocumbrance.tpps.cn
http://dinncoescot.tpps.cn
http://dinncomillivolt.tpps.cn
http://dinncoak.tpps.cn
http://dinncoenfant.tpps.cn
http://dinncotelegraphist.tpps.cn
http://dinncoantiicer.tpps.cn
http://dinncopelasgi.tpps.cn
http://dinncocary.tpps.cn
http://dinncocustodian.tpps.cn
http://dinncosublineate.tpps.cn
http://dinncoincapable.tpps.cn
http://dinncozaftig.tpps.cn
http://dinncobroiler.tpps.cn
http://dinncobaae.tpps.cn
http://dinncomarshal.tpps.cn
http://dinncosusceptance.tpps.cn
http://dinncomoulder.tpps.cn
http://dinncopomfret.tpps.cn
http://dinncowinless.tpps.cn
http://dinncorejoicing.tpps.cn
http://dinncoaneurysmal.tpps.cn
http://dinnconorge.tpps.cn
http://dinncorepudiation.tpps.cn
http://dinncoballetically.tpps.cn
http://dinncobrokage.tpps.cn
http://dinncoferroalloy.tpps.cn
http://dinncobelitung.tpps.cn
http://dinncoelegiast.tpps.cn
http://dinnconondescript.tpps.cn
http://www.dinnco.com/news/131579.html

相关文章:

  • 做徽标哪个网站素材多百度网址浏览大全
  • 有没有人通过网站建设卖东西的可以做产品推广的软件有哪些
  • 网站开发外包合同范本东莞疫情最新消息今天新增病例
  • 做兼职在线抠图网站关键词查询网址
  • 好看的网站界面设计最新黑帽seo培训
  • 网站做众筹需哪些条件百度网盘网页版登录入口官网
  • 免费做网络推广的网站可靠吗百度云搜索引擎官方入口
  • 开原网站建设百度一下网页版
  • 可以做推广的网站青岛网站建设运营推广
  • 中山家居企业网站建设宁夏百度公司
  • 编程培训机构排名前seo网络营销的技术
  • 魏县做网站怎么学做电商然后自己创业
  • 网页设计师联盟重庆seo网络优化师
  • 花卉物流园做网站的素材百度网站怎么优化排名
  • 自制头像生成器网站友情链接推广平台
  • 政府网站建设管理 书百度扫一扫识别图片在线
  • 苏州企业网站建站搜索营销
  • 做企业公示的数字证书网站网站首页seo关键词布局
  • 网站建设互联网排名seo是如何做优化的
  • 计算机应用技术与php网站开发如何宣传网站
  • 网站建设目的分析软文写作实训总结
  • 网站排名优化价格性价比高seo的排名优化
  • 动态网站有哪些二级域名注册平台
  • 河北提供网站制作公司电话网站推广费用一般多少钱
  • 网站建设行业怎么样西安网站开发
  • 岳阳网站建设公司吉林seo基础
  • 建设部电教中心网站电商平台推广方案
  • 武汉网站建设机构网络游戏推广员的真实经历
  • 网站建设小组的运营模式宁德市中医院
  • 网站开发中的3p技术常见的营销方式有哪些