commit
1982b53119
4 changed files with 45 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
MAINTAINER Mohammad Naghavi <mohamnag@gmail.com>
|
LABEL author="Mohammad Naghavi <mohamnag@gmail.com>"
|
||||||
|
|
||||||
ADD default.conf /etc/nginx/conf.d/default.conf
|
ADD default.conf /etc/nginx/conf.d/default.conf
|
||||||
ADD css/ /opt/www/file-browser/css/
|
ADD css/ /opt/www/file-browser/css/
|
||||||
|
|
12
Dockerfile-rootless
Normal file
12
Dockerfile-rootless
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
FROM nginxinc/nginx-unprivileged:stable-alpine
|
||||||
|
|
||||||
|
LABEL author="Mohammad Naghavi <mohamnag@gmail.com>"
|
||||||
|
|
||||||
|
ADD default-rootless.conf /etc/nginx/conf.d/default.conf
|
||||||
|
ADD css/ /opt/www/file-browser/css/
|
||||||
|
ADD image/ /opt/www/file-browser/image/
|
||||||
|
ADD js/ /opt/www/file-browser/js/
|
||||||
|
ADD index.html /opt/www/file-browser/
|
||||||
|
|
||||||
|
VOLUME /opt/www/files/
|
||||||
|
EXPOSE 8080
|
|
@ -12,12 +12,17 @@ A sample nginx configuration is also included which mounts **file browser** unde
|
||||||
|
|
||||||
Mainly for demonstration purposes a docker image is also available [here](https://hub.docker.com/r/mohamnag/nginx-file-browser/).
|
Mainly for demonstration purposes a docker image is also available [here](https://hub.docker.com/r/mohamnag/nginx-file-browser/).
|
||||||
In order to use this docker image, the volume which has to be served should
|
In order to use this docker image, the volume which has to be served should
|
||||||
be mounted under `/opt/www/files/` and port `80` of container shall be mapped
|
be mounted under `/opt/www/files/` and port `80` (root) or `8080` (rootless)) of container shall be mapped
|
||||||
to a proper port on host. A proper run would look like:
|
to a proper port on host. A proper run would look like:
|
||||||
|
|
||||||
|
root
|
||||||
```
|
```
|
||||||
$ docker run -p 8080:80 -v /path/to/my/files/:/opt/www/files/ mohamnag/nginx-file-browser
|
$ docker run -p 8080:80 -v /path/to/my/files/:/opt/www/files/ mohamnag/nginx-file-browser
|
||||||
```
|
```
|
||||||
|
rootless:
|
||||||
|
```
|
||||||
|
$ docker run -p 8080:8080 -v /path/to/my/files/:/opt/www/files/ mohamnag/nginx-file-browser
|
||||||
|
```
|
||||||
|
|
||||||
With container up and running you can point your browser to IP of docker host with given port to view the files. For example with above run command assuming docker host having IP with `192.168.0.200` we have to navigate to this URL:
|
With container up and running you can point your browser to IP of docker host with given port to view the files. For example with above run command assuming docker host having IP with `192.168.0.200` we have to navigate to this URL:
|
||||||
|
|
||||||
|
|
26
default-rootless.conf
Normal file
26
default-rootless.conf
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
server {
|
||||||
|
listen 8080;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
root /opt/www/;
|
||||||
|
index index.html index.htm;
|
||||||
|
|
||||||
|
location /files/ {
|
||||||
|
alias /opt/www/files/;
|
||||||
|
index ___i; # we really need no index here, just listing files
|
||||||
|
|
||||||
|
autoindex on;
|
||||||
|
autoindex_format json;
|
||||||
|
disable_symlinks off;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /opt/www/file-browser/;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue