User Tools

Site Tools


servers:nginx:files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
servers:nginx:files [2018/12/23 01:50] – [Link Sharing] Sean Rhoneservers:nginx:files [2018/12/23 01:51] (current) – [Link Sharing] Sean Rhone
Line 1: Line 1:
 +====== 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'
 +
 +<code>
 +Test
 +</code>
 +
 +====== Link Sharing ======
 +
 +  * Change ''URL#'' to a download link
 +  * Change ''NAME#'' to a descriptive name
 +  * :!: ''<a href=../>../</a>'' 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'
 +
 +<code>
 +<a href=../>../</a>
 +<br>
 +<a href=https://www.startpage.com>StartPage</a>
 +<br>
 +<a href=URL1>NAME1</a>
 +<br>
 +<a href=URL2>NAME2</a>
 +</code>
 +
 +====== nginx Configuration ======
 +
 +===== Server Block =====
 +
 +  sudo -e '/etc/nginx/sites-available/files.conf'
 +
 +<code>
 +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;
 +
 +}</code>
 +
 +==== 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
/var/www/wiki/data/pages/servers/nginx/files.txt · Last modified: 2018/12/23 01:51 by Sean Rhone