====== Information ======
* Files
* [[Information:Realm of Espionage]]
* https://files.realmofespionage.xyz
===== Prerequisites =====
* [[distros:ubuntu_server | Ubuntu Server]]
* [[servers:nginx_php_php-fpm | nginx]]
* [[servers:nginx:lets_encrypt | Let's Encrypt]]
===== Notes =====
* TODO
====== Directory ======
===== Main =====
****
sudo mkdir -p '/var/www/files' && sudo chown -R 'www-data':'www-data' '/var/www/files' && sync
===== Subdirectories =====
* :!: Change ''x''
sudo mkdir -p '/var/www/files/x' && sudo chown -R 'www-data':'www-data' '/var/www/files' && sync
====== index ======
* :!: Using an ''index.html'' in a specific directory causes the file listing to not show
sudo -u 'www-data' -e '/var/www/files/index.html'
Test
====== Link Sharing ======
* Change ''URL#'' to a download link
* Change ''NAME#'' to a descriptive name
* :!: ''../'' is intentional and is used to go back to the last page
* TODO: Maybe make those ''CHANGEME'' and use ''sed'' to change them if I use this frequently
* TODO: Figure out what the above TODO meant
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'
../
StartPage
NAME1
NAME2
====== 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 ======
* Change ''x'' to file
scp x espionage724@192.168.1.153:~
====== Allow Public Access To Files ======
* Change ''x'' to file
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