This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fd1e716
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM ubuntu:trusty | ||
|
||
RUN apt-get update && apt-get install -y nginx nginx-extras apache2-utils | ||
|
||
ENV USERNAME="" PASSWORD="" | ||
|
||
VOLUME /media | ||
COPY webdav.conf /etc/nginx/conf.d/default.conf | ||
RUN rm /etc/nginx/sites-enabled/* | ||
|
||
COPY entrypoint.sh / | ||
RUN chmod +x entrypoint.sh | ||
CMD /entrypoint.sh && nginx -g "daemon off;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '2' | ||
services: | ||
webdav: | ||
build: . | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- "/mnt:/media" | ||
environment: | ||
USERNAME: user | ||
PASSWORD: passwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
if [[ -n "$USERNAME" ]] && [[ -n "$PASSWORD" ]] | ||
then | ||
htpasswd -bc /etc/nginx/htpasswd $USERNAME $PASSWORD | ||
echo Done. | ||
else | ||
echo Using no auth. | ||
sed -i 's%auth_basic "Restricted";% %g' /etc/nginx/conf.d/default.conf | ||
sed -i 's%auth_basic_user_file htpasswd;% %g' /etc/nginx/conf.d/default.conf | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
server { | ||
listen 80; | ||
|
||
access_log /dev/stdout; | ||
error_log /dev/stdout info; | ||
|
||
client_max_body_size 0; | ||
|
||
location / { | ||
create_full_put_path on; | ||
autoindex on; | ||
autoindex_exact_size off; | ||
autoindex_localtime on; | ||
charset utf-8; | ||
|
||
dav_methods PUT DELETE MKCOL COPY MOVE; | ||
dav_ext_methods PROPFIND OPTIONS; | ||
dav_access user:rw group:rw all:rw; | ||
|
||
auth_basic "Restricted"; | ||
auth_basic_user_file /etc/nginx/htpasswd; | ||
|
||
root /media/; | ||
} | ||
} |