以下是000-default.conf
etc/apache2/sites-available/000-default.conf
文件
DavLockDB /var/www/DavLock
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /webdav /var/www/webdav
<Directory /var/www/webdav>
DAV On
AuthType Digest
AuthName "webdav"
AuthUserFile /etc/apache2/users.password
Require valid-user
</Directory>
</VirtualHost>
现在本地我可以从服务器
访问我的文件这是我在rails app中的.env文件
WEBDAV_USER=username
WEBDAV_PASSWORD=password
WEBDAV_READ_URL=http://localhost/webdav
WEBDAV_WRITE_URL=http://localhost/webdav
但是当我尝试使用rails中的webdav执行某些操作时,它会给我以下错误
CarrierWave::IntegrityError (Can't create a new collection:)
CarrierWave::IntegrityError (Can't download a new file:)
This server could not verify that you\nare authorized to access the document\nrequested. Either you supplied the wrong\ncredentials
我不明白为什么会出现此错误,因为我在本地访问它时webdav服务器工作正常,但rails app无法访问它。