Table of Contents

Information

Prerequisites

Notes

Directory

Main

sudo mkdir -p '/var/www/files' && sudo chown -R 'www-data':'www-data' '/var/www/files' && sync

Subdirectories

sudo mkdir -p '/var/www/files/x' && sudo chown -R 'www-data':'www-data' '/var/www/files' && sync

index

sudo -u 'www-data' -e '/var/www/files/index.html'
Test

Link Sharing

sudo mkdir -p '/var/www/files/links' && sudo chown -R 'www-data':'www-data' '/var/www/files' && sudo -u 'www-data' -e '/var/www/files/links/index.html'
<a href=../>../</a>
<br>
<a href=https://www.startpage.com>StartPage</a>
<br>
<a href=URL1>NAME1</a>
<br>
<a href=URL2>NAME2</a>

nginx Configuration

Server Block

sudo -e '/etc/nginx/sites-available/files.conf'
server {
    listen '443' 'ssl' 'http2';
    server_name 'files.realmofespionage.xyz';
    root '/var/www/files';
    index 'index.html';

    include '/etc/nginx/snippets/restrictions.conf';
    include '/etc/nginx/snippets/headers.conf';

    add_header Content-Security-Policy "default-src 'self'" always;

    #access_log /var/log/nginx/files-access.log;
    #error_log /var/log/nginx/files-error.log;

}

Enable Server Block

sudo rm -f '/etc/nginx/sites-enabled/files.conf' && sudo ln -s '/etc/nginx/sites-available/files.conf' '/etc/nginx/sites-enabled' && sudo systemctl reload 'nginx'

Transfer Files To Server

scp x espionage724@192.168.1.153:~

Allow Public Access To Files

cd '/var/www/files' && sudo mv x && sudo chcon -R -t 'httpd_sys_rw_content_t' '/var/www/files' && sudo chown -R 'nginx':'nginx' '/var/www/files' && cd ~ && sync