https://github.com/antlafarge/http-share
Share a directory through HTTP (protected by htaccess password) by using nginx.
https://github.com/antlafarge/http-share
docker docker-container htpasswd http nginx
Last synced: 2 months ago
JSON representation
Share a directory through HTTP (protected by htaccess password) by using nginx.
- Host: GitHub
- URL: https://github.com/antlafarge/http-share
- Owner: antlafarge
- Created: 2021-04-17T18:57:16.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-08T22:12:28.000Z (4 months ago)
- Last Synced: 2025-01-08T23:24:49.283Z (4 months ago)
- Topics: docker, docker-container, htpasswd, http, nginx
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/antlafarge/http-share
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# HTTP-SHARE
Share a directory through HTTP (protected by htaccess password) by using nginx.
## Docker
# Create the login/password to access the http share.
echo "<LOGIN>:$(perl -le 'print crypt("<PASSWORD>", "1xzcq")')" > ~/http-share.htpasswddocker run -d \
--name <CONTAINER-NAME> \
--restart <RESTART> \
-v <PATH>:/usr/share/nginx/html/<SHARE-NAME>:ro \
-v ~/http-share.htpasswd:/etc/nginx/conf.d/.htpasswd:ro \
-p <PORT>:80 \
antlafarge/http-share:latest
*Parameters indented twice are optional.*- Replace **``** and **``** by the login and password which will be required to access the http share.
- Replace **``** by the name you want for the container.
- Replace **``** by `on-failure`, `unless-stopped` or `always`.
- Replace **``** by the http port you will open in your router NAT.
- Replace **``** by the absolute path to the directory you want to share and **``** by the name you want for the shared directory. The share-name is optional if you need to share only 1 directory. You can add many volumes if you want to share multiple directories (see examples).*Note : Do not delete the file `http-share.htpasswd` on your host machine, it will be used by the container.*
### Example
# Create the login/password to access the http share.
echo "admin:$(perl -le 'print crypt("MyGreatPassword", "1xzcq")')" > ~/http-share.htpasswddocker run -d \
--name http-share \
--restart on-failure:2 \
-v "/mnt/hdd/public:/usr/share/nginx/html/Public:ro" \
-v "/mnt/hdd/shared:/usr/share/nginx/html/Shared:ro" \
-v "~/http-share.htpasswd:/etc/nginx/conf.d/.htpasswd:ro" \
-p 8080:80 \
antlafarge/http-share:latest
*Parameters indented twice are optional.*## Docker compose
echo "<LOGIN>:$(perl -le 'print crypt("<PASSWORD>", "1xzcq")')" > ~/http-share.htpasswd
services:
http-share:
image: antlafarge/http-share:latest
container_name: <CONTAINER-NAME> # optional
restart: <RESTART> # optional
volumes:
- "<PATH>:/usr/share/nginx/html/<SHARE-NAME>:ro"
- "~/http-share.htpasswd:/etc/nginx/conf.d/.htpasswd:ro"
ports:
- "<PORT>:80" # optional### Example
echo "admin:$(perl -le 'print crypt("MyGreatPassword", "1xzcq")')" > ~/http-share.htpasswd
services:
http-share:
image: antlafarge/http-share:latest
container_name: http-share # optional
restart: on-failure:2 # optional
volumes:
- "/mnt/hdd/public:/usr/share/nginx/html/Public:ro"
- "/mnt/hdd/shared:/usr/share/nginx/html/Shared:ro"
- "~/http-share.htpasswd:/etc/nginx/conf.d/.htpasswd:ro"
ports:
- "8080:80" # optional## Docker commands reminder
### Container stop
docker stop http-share### Container restart
docker restart http-share### Container logs
docker logs --follow --tail 100 http-share### Container delete
docker rm -f http-share### Image delete
docker rmi antlafarge/http-share:latest### Compose start
cd /path/to/docker-compose.yml/directory/
docker compose up -d### Compose stop
cd /path/to/docker-compose.yml/directory/
docker compose down