8.5 KiB
utworzone: 2022-05-17 tag: wikipage
referencje:: Serwis
Apache
https://linuxconfig.org/webdav-server-setup-on-ubuntu-linux
Konfiguracja
sudo a2enmod dav_fs
/etc/apache2/apache2.conf: (dodać)
<Directory /srv/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
/etc/apache2/sites-available/daw.lemiesz.org.conf:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
Servername dav.lemiesz.org
DocumentRoot /srv/dav/static
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /srv/dav/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
Alias /dav /srv/dav/files
<Location /dav>
AuthType "Basic"
AuthName "Password Manager"
AuthBasicProvider file
AuthUserFile "/srv/dav/.htpasswd"
Require valid-user
DAV On
Options Indexes
</Location>
</VirtualHost>
Zmiana hasła
sudo htpasswd /srv/dav/.htpasswd ali0
Uprawnienia
https://www.d7031.de/content/apache-webdav-read-write-permissions/
Klient linii poleceń
cadaver
xGit
https://cets.seas.upenn.edu/answers/git-repository.html
cd ~ACCOUNT/html/webdav/
mkdir project-X
cd project-X
git --bare init
cd hooks
cp -p post-update.sample post-update
./post-update
chown www-data.www-data project-X
Test
cd ~ACCOUNT/tmp
git clone https://ACCOUNT@webdav.seas.upenn.edu/~ACCOUNT/webdav/project-X
cd project-X
git add *
git commit -m 'initial commit'
git push origin master
Maven
Zmiany w build.gradle
Groovy
apply plugin: 'maven' ???
configurations {
deployerJars
}
group = "org.lemiesz"
version = "1.0-01"
dependencies {
...
deployerJars "org.apache.maven.wagon:wagon-webdav:1.0-beta-2"
...
}
…
task writeNewPom {
doLast {
pom {
project {
inceptionYear '2008'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}.writeTo("$buildDir/newpom.xml")
}
}
//Maven
uploadArchives {
repositories.mavenDeployer {
configuration = configurations.deployerJars
repository(url: "http://maven.lemiesz.org/dav/") {
authentication(userName: "maven", password: "maven")
}
}
}
Kotlin
val deployerJars by configurations.creating
plugins {
maven
}
task("writeNewPom") {
doLast {
maven.pom {
withGroovyBuilder {
"project" {
setProperty("inceptionYear", "2008")
"licenses" {
"license" {
setProperty("name", "The Apache Software License, Version 2.0")
setProperty("url", "http://www.apache.org/licenses/LICENSE-2.0.txt")
setProperty("distribution", "repo")
}
}
}
}
}.writeTo("$buildDir/newpom.xml")
}
}
tasks.named("uploadArchives") {
repositories.withGroovyBuilder {
"mavenDeployer" {
setProperty("configuration", deployerJars)
"repository"("url" to "http://maven.lemiesz.org/dav/") {
"authentication"("userName" to "maven", "password" to "maven")
}
}
}
}
Utworzyć folder projektu na serwerze
group/testMaven/1.0-SNAPSHOT/
mkdir files/org/lemiesz/testMaven/1.0-{01..30}
chown www-data:www-data files/org/lemiesz/testMaven
Upload projektu
./gradlew uploadArchives
https://discuss.gradle.org/t/cannot-publish-new-artefact-to-webdav-repo-with-maven-plugin/1302
https://docs.gradle.org/current/userguide/maven_plugin.html
https://gist.github.com/EronWright/d856aad6302e0c18ccd96164540a653c
Użytek
Gradle:
groovy
repositories {
maven {
url 'http://maven.lemiesz.org/dav/'
credentials {
username = 'joe'
password = 'secret'
}
}
}
kotlin
repositories {
maven {
url = uri("http://maven.lemiesz.org/dav/")
credentials {
username = 'joe'
password = 'secret'
}
}
}
Automatyczny update:
https://stackoverflow.com/questions/13565082/how-can-i-force-gradle-to-redownload-dependencies
https://stackoverflow.com/questions/25965901/how-to-make-gradle-repository-point-to-local-directory
Nginx (lepiej użyć Apache2)
https://starbeamrainbowlabs.com/blog/article.php?article=posts%2F237-WebDav-Nginx-Setup.html
http://nginx.org/en/docs/http/ngx_http_dav_module.html
https://www.captainark.net/2016/03/26/webdav-with-nginx/
Konfiguracja
Instalacja
sudo apt install nginx-full
/etc/nginx/sites-avalible/dav.lemiesz.org
server {
listen 80;
listen [::]:80;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name dav.lemiesz.org;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location /dav/ {
root /srv/dav;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
# Adjust as desired:
dav_access user:rw group:rw all:r;
client_max_body_size 0;
create_full_put_path on;
client_body_temp_path /srv/client-temp;
autoindex on;
allow 192.168.10.0/24;
allow 127.0.0.1;
deny all;
}
}