BytemarkHosting / docker-webdav

Docker image for running an Apache WebDAV server
MIT License
350 stars 166 forks source link

乱码问题 #18

Open peter-cls opened 4 years ago

peter-cls commented 4 years ago

您好,现在部署后出现乱码,发现是没有申明utf8导致的,请问在哪里修改?

peter-cls commented 4 years ago

Hello, there is a mess after deployment. It is found that utf8 was not declared. Where can I change it?

brlin-tw commented 4 years ago

Hello, I proposed a fix in the PR. Cheers!

peter-cls commented 4 years ago

thx

发自我的iPad

在 2020年4月15日,22:30,林博仁(Buo-ren, Lin) notifications@github.com 写道:



Hello, I proposed a fix in the PR. Cheers!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FBytemarkHosting%2Fdocker-webdav%2Fissues%2F18%23issuecomment-614074292&data=02%7C01%7C%7Cde57db382ede455b6b4508d7e1498ded%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637225578337626675&sdata=N%2FhVR0KrW08izzbooj0ToBMizI6sdwfx5yzhYJaguDE%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOP4GYIQ3JT2GJV3HOWQ5J3RMXAIRANCNFSM4KR2CL3A&data=02%7C01%7C%7Cde57db382ede455b6b4508d7e1498ded%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637225578337626675&sdata=SM3GM3Lu3UURABeF4CFj7RcLuS%2FkSVeFvxj7WeOrW8s%3D&reserved=0.

peter-cls commented 4 years ago

请问能更新hub.docker的文件吗?不会改代码这种!

xmu714 commented 4 years ago

请问能更新hub.docker的文件吗?不会改代码这种!

你好,我今天也发现了这个问题。简单的解决办法是通过这个容器的终端进去 vi conf/conf-enabled/dav.conf 添加UTF8声明,然后重启容器,就解决了乱码。但是这个文件会随着容器更新被覆盖,所以可以把修改的文件放到宿主机,然后映射到conf/conf-available/dav.conf

peter-cls commented 4 years ago

请问能更新hub.docker的文件吗?不会改代码这种!

你好,我今天也发现了这个问题。简单的解决办法是通过这个容器的终端进去 vi conf/conf-enabled/dav.conf 添加UTF8声明,然后重启容器,就解决了乱码。但是这个文件会随着容器更新被覆盖,所以可以把修改的文件放到宿主机,然后映射到conf/conf-available/dav.conf

非常感谢,请问申明的命令怎么写?文件内容如下

DavLockDB "/var/lib/dav/DavLock" Alias / "/var/lib/dav/data/" <Directory "/var/lib/dav/data/"> Dav On Options Indexes FollowSymLinks

AuthType Digest AuthName "WebDAV" AuthUserFile "/user.passwd"

Require valid-user

These disable redirects on non-GET requests for directories that

don't include the trailing slash (for misbehaving clients).

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[01234]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
BrowserMatch " Konqueror/4" redirect-carefully
BrowserMatch "^gvfs" redirect-carefully

wyxls commented 4 years ago

请问能更新hub.docker的文件吗?不会改代码这种!

你好,我今天也发现了这个问题。简单的解决办法是通过这个容器的终端进去 vi conf/conf-enabled/dav.conf 添加UTF8声明,然后重启容器,就解决了乱码。但是这个文件会随着容器更新被覆盖,所以可以把修改的文件放到宿主机,然后映射到conf/conf-available/dav.conf

非常感谢,请问申明的命令怎么写?

原image默认没有这一行,需要手动添加后再重启容器,但image更新的话又会被覆盖掉。推荐2个方法避免更新覆盖dav.conf 1、在宿主机外置保存修改好的dav.conf,然后通过volume挂载到对应路径(/usr/local/apache2/conf/conf-available/dav.conf),注意文件权限问题 2、自己build一个image,直接将声明UTF-8内置

<Directory "/var/lib/dav/data/">
  Dav On
  Options Indexes FollowSymLinks

  AuthType Basic
  AuthName "WebDAV"
  IndexOptions Charset=utf-8      <-----------添加这一行
  AuthUserFile "/user.passwd"
  <RequireAny>
    Require valid-user
  </RequireAny>
</Directory>
peter-cls commented 4 years ago
IndexOptions Charset=utf-8

问题解决了,多谢!!此镜像应该不会更新了!

xmu714 commented 4 years ago

@wyxls 感谢层主的方法,我之前在做覆盖的时候,直接从它的命令里面找的源路径conf/conf-available/dav.conf 结果依然被覆盖,看了你的回复才想起来要用绝对路径。

wyxls commented 4 years ago

@wyxls 感谢层主的方法,我之前在做覆盖的时候,直接从它的命令里面找的源路径conf/conf-available/dav.conf 结果依然被覆盖,看了你的回复才想起来要用绝对路径。

其实Dockerfile里有注释,httpd:alpine镜像拉取后默认workdir是/usr/local/apache2

# These variables are inherited from the httpd:alpine image:
# ENV HTTPD_PREFIX /usr/local/apache2
# WORKDIR "$HTTPD_PREFIX"
peter-cls commented 4 years ago

@wyxls @xmu714 感谢层主的方法,我之前在做覆盖的时候,直接从它的命令里面找的源路径conf/conf-available/dav.conf 结果依然 被覆盖,看了你的回复才想起来要用绝对路径。

请问是要映射/usr/local/apache2嘛?我映射了也没有dav.conf这个文件?

peter-cls commented 4 years ago

@wyxls 感谢层主的方法,我之前在做覆盖的时候,直接从它的命令里面找的源路径conf/conf-available/dav.conf 结果依然被覆盖,看了你的回复才想起来要用绝对路径。

其实Dockerfile里有注释,httpd:alpine镜像拉取后默认workdir是/usr/local/apache2

# These variables are inherited from the httpd:alpine image:
# ENV HTTPD_PREFIX /usr/local/apache2
# WORKDIR "$HTTPD_PREFIX"

我注意到这里的/usr/local/apache2/conf/conf-available/dav.conf 是不是应该conf-enable,我映射/usr/local/apache2/conf/conf-enable/dav.conf 或者/usr/local/apache2/conf/conf-enable 都不行啊,然后/usr/local/apache2/conf/conf-enable/dav.conf 也不行

wyxls commented 4 years ago

@wyxls 感谢层主的方法,我之前在做覆盖的时候,直接从它的命令里面找的源路径conf/conf-available/dav.conf 结果依然被覆盖,看了你的回复才想起来要用绝对路径。

其实Dockerfile里有注释,httpd:alpine镜像拉取后默认workdir是/usr/local/apache2

# These variables are inherited from the httpd:alpine image:
# ENV HTTPD_PREFIX /usr/local/apache2
# WORKDIR "$HTTPD_PREFIX"

我注意到这里的/usr/local/apache2/conf/conf-available/dav.conf 是不是应该conf-enable,我映射/usr/local/apache2/conf/conf-enable/dav.conf 或者/usr/local/apache2/conf/conf-enable 都不行啊,然后/usr/local/apache2/conf/conf-enable/dav.conf 也不行

conf/conf-enable里的dav.conf是个软链接,实际文件是conf/conf-available/dav.conf 容器启动后会读取改动这个文件,单纯挂载覆盖还可能有权限问题,所以我个人最推荐的方法还是直接build image,这样更方便彻底一点