.env
:
:
# USER:PASSWORD:UID
# USER **must** be "website_user" for the container to work
SFTP_USERS=website_user:SOME_PW
I可以使用SFTP登录端口2222上的容器,但是每当我尝试上传文件时,我都会收到以下错误(使用filezilla):
Error: /upload/index.html: open for write: permission denied
我可以在filezilla上看到
upload
dir归root:root
拥有权限755。
我不确定从这里去哪里。
这就是我解决的方式:
我最终得到了此文件:
services:
webserver:
image: nginx:latest
container_name: nginx_server
ports:
- "80:80"
volumes:
- web_data:/html
- ./nginx.conf:/etc/nginx/nginx.conf:ro
# - type: volume
# source: web_data
# target: /usr/share/nginx/html
# volume:
# subpath: html
restart: always
sftp:
image: atmoz/sftp:latest
container_name: sftp_server
ports:
- "2222:22"
volumes:
- web_data:/home/my_website
# environment:
# SFTP_USERS: ${SFTP_USERS} # Read credentials from the .env file
command: my_website:my_website_pw:::html
restart: always
volumes:
web_data:
notice我评论过的可悲尝试将其安装为子安装。 我基本上发现的是,安装座是您要编写的文件夹。这就是为什么我要安装
nginx/html
而不是web_data:/home/my_website
进行SFTP容器管理。
CONS:
由于dir是该卷的子目录,因此我还必须将其安装在nginx容器上。这需要我自定义(并安装)Nginx配置文件:html
基本上,我将卷安装到
command: my_website:my_website_pw:::html
,然后具有子目录html
,这是Web数据现在所在的位置。