specify-expiry-and-urllen #2
25
README.md
25
README.md
@ -34,7 +34,6 @@ Start by adjusting the necessary configuration variables in `config.toml`.
|
|||||||
Execute the following commands to build and initiate HardFiles:
|
Execute the following commands to build and initiate HardFiles:
|
||||||
```
|
```
|
||||||
go build -o hardfiles main.go
|
go build -o hardfiles main.go
|
||||||
mkdir files
|
|
||||||
./hardfiles
|
./hardfiles
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -46,7 +45,8 @@ docker compose up -d
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### 3. Default Port:
|
#### 3. Default Port:
|
||||||
By default, HardFiles listens on port `5000`. For production environments, it's recommended to use a robust web server like Nginx or Apache to proxy traffic to this port.
|
|
||||||
|
By default, HardFiles listens on port `5000`. For production environments, it's recommended to use a robust web server like Nginx or Caddy to proxy traffic to this port. Just don't use Apache ever.
|
||||||
|
|
||||||
###### Using Nginx as a Reverse Proxy:
|
###### Using Nginx as a Reverse Proxy:
|
||||||
|
|
||||||
@ -62,9 +62,11 @@ server {
|
|||||||
location / {
|
location / {
|
||||||
proxy_pass http://localhost:5000;
|
proxy_pass http://localhost:5000;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
access_log /dev/null;
|
||||||
|
error_log /dev/null;
|
||||||
|
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
ssl_certificate /etc/letsencrypt/live/your_domain.com/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/your_domain.com/fullchain.pem;
|
||||||
ssl_certificate_key /etc/letsencrypt/live/your_domain.com/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/your_domain.com/privkey.pem;
|
||||||
@ -77,21 +79,38 @@ For obtaining the Let's Encrypt certificates, you can use tools like `certbot` t
|
|||||||
|
|
||||||
Remember, by using a reverse proxy, you can run HardFiles without needing root privileges and maintain a more secure environment.
|
Remember, by using a reverse proxy, you can run HardFiles without needing root privileges and maintain a more secure environment.
|
||||||
|
|
||||||
|
###### Using Caddy as a Reverse Proxy:
|
||||||
|
|
||||||
|
```caddy
|
||||||
|
your_domain.com {
|
||||||
|
reverse_proxy localhost:5000
|
||||||
|
|
||||||
|
tls /etc/letsencrypt/live/your_domain.com/fullchain.pem /etc/letsencrypt/live/your_domain.com/privkey.pem
|
||||||
|
|
||||||
|
log {
|
||||||
|
output discard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## cURL Uploads & Bash Alias
|
## cURL Uploads & Bash Alias
|
||||||
|
|
||||||
If you frequently upload files to HardFiles via the command line, you can streamline the process by setting up a bash alias. This allows you to use a simple command, like `upload`, to push your files to HardFiles using `curl`.
|
If you frequently upload files to HardFiles via the command line, you can streamline the process by setting up a bash alias. This allows you to use a simple command, like `upload`, to push your files to HardFiles using `curl`.
|
||||||
|
|
||||||
#### Setting Up:
|
#### Setting Up:
|
||||||
|
|
||||||
1. **Edit your `.bashrc` file:** Open your `~/.bashrc` file in a text editor. You can use `nano` or `vim` for this purpose:
|
1. **Edit your `.bashrc` file:** Open your `~/.bashrc` file in a text editor. You can use `nano` or `vim` for this purpose:
|
||||||
```shell
|
```shell
|
||||||
nano ~/.bashrc
|
nano ~/.bashrc
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Add the `upload` function:** At the end of the `.bashrc` file, append the following function (replace the domain if you are running your own instance):
|
2. **Add the `upload` function:** At the end of the `.bashrc` file, append the following function (replace the domain if you are running your own instance):
|
||||||
```shell
|
```shell
|
||||||
upload() {
|
upload() {
|
||||||
curl -F file=@$1 https://hardfiles.org/
|
curl -F file=@$1 https://hardfiles.org/
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Reload your .bashrc file: To make the new function available in your current session, reload your .bashrc:
|
3. Reload your .bashrc file: To make the new function available in your current session, reload your .bashrc:
|
||||||
```shell
|
```shell
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
|
Loading…
Reference in New Issue
Block a user