Skip to content

New instructions + minor URI fix #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,39 @@ effectively together with [nginx's autoindex module](http://nginx.org/en/docs/ht

A sample nginx configuration is also included which mounts **file browser** under root (`/`) and mounts files to be listed under `/files` path. Hence is the `filesBaseUrl` under

## Installation / Configuration
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that in your use case a direct installation was probably a better choice, however in all these years I have been using this as an docker image (and that should remain the main focus). So it would be a good point to highlight that there are multiple options on how to use this and one is using the docker image and other is this direct installation.
Lets add a title called ## Usage under which we will have the ### Using with Docker and then this part under ### Direct Installation after that.


The system has a default to use the location's root (E.G. the site's root location `www.example.net/`, and the physical of `/opt/www/`). This can be configured to move both the ***installation*** location and the location to be browseable.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well we are talking about the "file browser UI location" and "listed files location". I would say lets adjust the wording to keep it consistent over the whole doc.


1. Clone the repo to the server
2. Create an installation location (E.G. `/var/www/files/`)
3. Copy the `css`, `image`, `js` directories to the installation location
4. Copy the `index.html` to the installation location
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up until here, we can just do it in one step of: "clone the repo under /var/www/files/ or any directory you want to install the file browser's web UI from". WDYT?

also I would argue that choosing directory name files/ for web UI, which in default setup is used for the listed files is a confusing choice. what about something like /var/www/ui/?

5. Create the location for the files to be shared & browsable (E.G. `/var/www/isos`)
6. Copy the files to the location
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically seen, you don't need to copy. for many use cases copying (probably gigabytes of data) is not an option. so either copy or using a symlink (which is described a at the end of this doc).

7. Make sure the files in the installation location & the location for the files to be shared are owned by the nginx process (E.G. `www-data:www-data` for Debian/Ubuntu based saystems)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is owning required? I think being able to read files and list the directories should be enough.

Copy link

@MestreLion MestreLion Jun 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only must be readable by www-data, being owned by it is overkill. Maybe this can be worded as:

7. Make sure both the UI and shared files are at least readable by the nginx process[...] with `chmod +r -R ...`, and directories are browseable: `chmod +x ...`. Or make `www-data` own the files and directories: `chown -R www-data: ...`

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is definitely better, we just need someone to update the PR :)

8. Edit the nginx configuration file for the site (E.G. `/etc/nginx/sites-enabled/default`)
9. Create a location called files (see the example configuration below) and set the options appropriately
```
location /files {
root /var/www/files/;
index index.html index.htm;
}
```
10. Create a location for the files listing to be read by the application
```
location /myfiles {
autoindex on;
autoindex_format json;
}
```
11. Save the configuration and reload (or restart) the nginx process (E.G. `serivce nginx reload`)
12. Before loading the page to verify its working the `main.js` javascript file needs to be updated.
13. Edit the `main.js` file from the `<INSTALLDIR>/js/`
14. Find the line containing `var filesBaseUrl = "/files";` (about line 217). Change the `/files` to match the location from step 10.
15. Save the file
16. Loading the site now (E.G. `www.example.net/files`) will now load and show (as seen in the example pictures above)

## Using with docker

Mainly for demonstration purposes a docker image is also available [here](https://hub.docker.com/r/mohamnag/nginx-file-browser/).
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>File Browser</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">

<link href="css/vendor/normalize.css" rel="stylesheet" type="text/css">
<link href="css/vendor/skeleton.css" rel="stylesheet" type="text/css">
Expand Down