Used for transferring files to Apache.
Create Directory to Handle Uploaded Files
sudo mkdir -p /var/www/uploads/SecretUploadDirectory
Change the Owner to www-data
sudo chown -R www-data:www-data /var/www/uploads/SecretUploadDirectory
Create Nginx Configuration File
In /etc/nginx/sites-available/upload.conf
:
server {
listen 9001;
location /SecretUploadDirectory/ {
root /var/www/uploads;
dav_methods PUT;
}
}
Symlink our Site to the sites-enabled Directory
sudo ln -s /etc/nginx/sites-available/upload.conf /etc/nginx//sites-enabled/
Start Nginx
sudo systemctl restart nginx.service
Error messages can be found in: /var/log/nginx/error.log
.
For example:
ss -lnpt | grep '80'
ps -ef | grep '2811'
Could output something like python -m websockify 80 localhost:5901 -D
which means there is a module already listening to port 80. To get around we can get rid of the default Nginx configuration:
sudo rm /etc/nginx/sites-enabled/default
And now we test:
curl -T /etc/passwd
tail -1 /var/www/upload/SecretUploadDirectory/users.txt
Then we can navigate to http://localhost/SecretUploadDirectory
.