Nginx Permission Issues

Today I hope to have a short session to wrap things up.

I need to automate the file permissions for the static apps. This is what I decided to do yesterday:

chmod 701 /home/hatch
chmod 701 /home/hatch/barelytics
chmod 701 /home/hatch/barelytics/web-app
chmod 755 /home/hatch/barelytics/web-app/static

Having some issues with this approach, but now that I'm thinking more clearly, I think I'll organize things a bit different. I'm very uncomfortable with serving files from home, even with proper permissions set up, so I'll move them to a public dir: /var/www

Wasted so much time wrestling with various nginx and permission issues, but it's finally working, and the structure is much simpler and safer

sudo mkdir -p "/var/www/app.barelytics.io"
sudo chmod -R 775 "/var/www/app.barelytics.io"
sudo chown -R www-data:www-data "/var/www/app.barelytics.io"
sudo chown -R hatch:hatch "/var/www/app.barelytics.io"

There's a big issue that I see now, and that is caching. The index.html is cached by the browser, and the script names are randomized at build. This means that the html will reference old versions of scripts, or worse, try to reference nonexistent scripts and break. Not sure what the best solution here is, I will have to investigate.

Really sad I didn't make much progress today. Hopefully tomorrow.